You are on page 1of 1

MATLAB Tutorial

1. Generate a square wave of amplitude 1 (min –1 to max +1) and period T = 0.2 s. Display
the square wave from 0 to 1.0 s. Use the MATLAB function ‘square’ (type help square
for a basic description or search the help window for more detailed explanation).
2. Generate a square wave of amplitude 4 (min 0 to max 8) with period T = 0.1 s. Display
the signal from 0 to 2.0 s.
3. Consider the pulse train shown in the figure.

It has the trigonometric Fourier series representation as follows:

 k cos k t  (1)

2 
N
2 ( k 1) / 2
x(t )  0.5  1
k 1 
k odd

By Fourier theorem, x(t) should converge as N   . Develop a MATLAB script to plot


x(t) for various values of N to show that the summed series approaches the original series
as N increases. (Hint: plot 1001 points from t = –3 to x = 3 and try N = 7 first, then N =
107, then N = 1007. You may choose to display a different time range and use different
values of N if you wish so long as your plots show the effect of using different numbers
of coefficients in the summation.)

You might also like