Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

Continuous and Discrete Time Signals

10

-10 0 10 20 40 60 80 100 t (ms)

-10 0 10 20 30 40 50 n (samples)

Plot and step functions


t
n

plot (x,y)

stem (x,y)

Where: x - horizontal axis (vector) y vertical axis (vector) ***x and y must have the same length

square(t,duty)

2*pi

>> t = 1:100; >> y = square(t,80); >> plot(t,y)

Fs = 20000; F = 1000; f = F/Fs; dc = 50; Amp = 1; t = 0:1/Fs:0.005; x = Amp*square(2*pi*F*t,dc) plot(t,x);

T = 1/1000

sawtooth(t) generates a sawtooth wave with period 2pi for the elements of time vector t.

t = -10:0.1:10; A = 1; y = A*sawtooth(t); plot(t,y);

2*pi

sawtooth(t, width)
W=0 W = 0.5

2*pi

2*pi

t = -10:0.1:10; A = 1; w = xx ; y = A*sawtooth(t,w); plot(t,y);

W=1
If no w is included it will use a default w =1 2*pi

Fs = 20000; F = 1000; f = F/Fs; Amp = 1; t = 0:1/Fs:0.005; x = sawtooth(2*pi*F*t) plot(t,x);

T = 1/1000

tripults(t,w)
t = -5:0.1:5; w = 4; y = tripuls(t,w); plot(t,y);

sinc(t) sinc(t) = sin(pi*t)/(pi*t)

t = -5:.01:5; plot(t,sinc(t))

SQUARE WAVE
The square wave contains a fundamental and a series of ODD HARMONICS that is harmonics which are odd number multiples of the fundamental (x3 x5 x7 etc.) These are called the 3rd harmonic, 5th harmonic etc.

TRIANGULAR WAVE
The triangular wave also contains a fundamental and a series of ODD HARMONICS, but in this case, each successive harmonic component starts off in the opposite PHASE to the previous one. i.e. the 3rd harmonic starts by going positive the 5th harmonic begins by going negative, the 7thpositive and so on.

SAWTOOTH WAVE
The sawtooth wave contains a fundamental and both ODD and EVEN HARMONICS.

Fs = 20000; F = 1000; f = F/Fs; t = 0:99; Amp = 5; x = Amp*sin(2*pi*f*t); stem(t,x);

Fs = 20000; F = 1000; f = F/Fs; n = 0:99; Amp =5; wnoise = 1.5 + sqrt(0.5)*randn(size(n)); x = Amp*sin(2*pi*f*n); y = wnoise+x; subplot(3,1,1);stem(n,x); subplot(3,1,2);stem(n,wnoise); subplot(3,1,3);stem(n,y);

Fs = 20000; F1 = 1000; F2 = 3000; F3 = 5000; n = 0:99; wnoise = sqrt(0.2)*randn(size(n)); x1 = sin(2*pi*n*F1/Fs); x2 = sin(2*pi*n*F2/Fs); x3 = sin(2*pi*n*F3/Fs); x4 = sin(2*pi*n*F3/Fs); s= x1 + x2 + x3 + wnoise; sf = fft(s,512); w = (0:255)/255*(Fs/2); plot(w,abs(sf(1:256)));

Fs = 20000; F1 = 1000; F2 = 3000; F3 = 5000; n = 0:99; wnoise = sqrt(0.2)*randn(size(n)); x1 = sin(2*pi*n*F1/Fs); x2 = sin(2*pi*n*F2/Fs); x3 = sin(2*pi*n*F3/Fs); x4 = sin(2*pi*n*F3/Fs); s= x1 + x2 + x3 + wnoise; sf = fft(s,512); w = (-255:255)/255*(Fs/2); plot(w,abs(sf(1:511)));

Fs = 20000; F = 1000; f = F/Fs; t = 0:1/Fs:0.005; Amp = 5; x = Amp*sin(2*pi*F*t); plot(t,x)

You might also like