Вы находитесь на странице: 1из 8

Signals and Systems Lab

Task Outline: 1. To form a sinusoidal signal with specified amplitude, frequency and for specific cycles. 2. To form a rectangular signal with specified amplitude, frequency and for specific cycles. 3. To form a triangular signal with specified amplitude, frequency and for specific cycles. 4. To form gates of sinusoidal, rectangular and triangular look. 5. To solve differential equation. 6. To find the Fourier Transform of functions such as: a. One sided exponential b. Double sided exponential c. Gate d. Sinc function

7. To find the Fourier Transform of functions such as: a. One sided exponential b. Double sided exponential c. Gate d. Sinc function
10 8 6 4 2

e. Step function f. Periodic signals

Sinusoidal Signals:

%Sinusoidal Signal with amplitude 10, frequency 50hz and for 2 -2 cycles clear all clc
-4 -6 -8 -1 0 0

0 .0 2

0 .0 4

0.06

0 .0 8

0 .1

0.12

0.14

Signals and Systems Lab

t=0:.0001:2*pi/50; y1=10*sin(2*50*t); y2=10*cos(2*50*t); plot(t,y1,t,y2)

Rectangular Signal Rectangular Signal with amplitude 10&15 frequency 50Hz, duty cycle 60% and 40% and for 2 0 2 cycles clear all clc t=0:.0001:2*pi/50; y1=10*square(2*50*t,60); y2=15*square(2*50*t,40); plot(t,y1,t,y2)
1 5 1 0 5 0 5 -0 1 -5 1 -0 2

02 .0

04 .0

06 .0

08 .0

0 .1

02 .1

04 .1

Triangular Signal
1 0

% Triangular Signal with amplitude 10 frequency 50 Hz and for 2 cycles 8


6 clear all clc 4 2 t=0:.0001:2*pi/50; y=10*sawtooth(2*50*t,0.5); 0 plot(t,y) 2 4 6 8

-0 1

02 . 0

04 . 0

06 . 0

08 . 0

0 . 1

02 . 1

04 . 1

Signals and Systems Lab

Gate Signal: % To form gates clear all clc syms t rg=(heaviside(t+5)-heaviside(t-5)); sg=sin(t)*(heaviside(t)-heaviside(t-pi)); subplot(2,1,1) ezplot(sg,[-2*pi,2*pi]) subplot(2,1,2) ezplot(rg,[-2*pi,2*pi])

Signals and Systems Lab

sin(t) (heaviside(t)-heaviside(t-)) 1

0.5

0 -6 -4 0 2 t heaviside(t+5)-heaviside(t-5) -2 4 6

0.5

0 -6 -4 -2 0 t 2 4 6

%Fourier transform of one sided exponential


clear all clc syms t y=5*exp(-5*t)*heaviside(t); Y=Fourier(y); a=real(Y);%Taking the real part b=imag(Y);%Taking the imaginary part FW=sqrt(a^2+b^2); theta=atan(b/a); subplot(2,2,1) ezplot(y) subplot(2,2,2) %(a2+b2)gives the magnitude %phase %input Signal

Signals and Systems Lab

ezplot(FW) %fourier transform (magnitude) subplot(2,2,[3,4]) ezplot(theta) %fourier transform (phase)


5 exp(-5 t) heaviside(t) (4 (5/2/(5+i w)+5/2/(5-i conj(w)))2-(5/(5+i w)-5/(5-i conj(w)))2)1/2 1/2 3 2 0.8 1 0 0 0.5 1 1.5 0.7 0.6 -5 0 5 t w -i atanh(1/2 (5/(5+i w)-5/(5-i conj(w)))/(5/2/(5+i w)+5/2/(5-i conj(w)))) 1 0.9

1 0.5 0 -0.5 -1 -6 -4 -2 0 w 2 4 6

%Fourier transform of double sided exponential


clear all clc syms t y=5*exp(-5*abs(t)); Y=Fourier(y); a=real(Y); b=imag(Y); %Taking the real part %Taking the imaginary part %magnitude %phase

FW=sqrt(a^2+b^2); theta=atan(b/a);

subplot(2,2,1) ezplot(y) %input Signal subplot(2,2,2) ezplot(FW) %fourier transform (magnitude)

Signals and Systems Lab

subplot(2,2,[3,4]) ezplot(theta)

%fourier transform (phase)

5 exp(-5 abs(t)) (4 (25/(25+w2)+25/(25+conj(w)2))2-(50/(25+w2)-50/(25+conj(w)2))2)1/2 1/2 2 3 2 1 0 -1 0 t 1 -5 0 w 5 1.5

-i atanh(1/2 (50/(25+w2)-50/(25+conj(w)2))/(25/(25+w2)+25/(25+conj(w)2))) 1 0.5 0 -0.5 -1

-6

-4

-2

0 w

%Fourier transform of a rectangular gate


clear all clc syms t y=heaviside(t+5)-heaviside(t-5); Y=Fourier(y); a=real(Y); b=imag(Y); %Taking the real part %Taking the imaginary part %magnitude %phase

FW=sqrt(a^2+b^2); theta=atan(b/a);

subplot(2,2,1) ezplot(y) %input Signal subplot(2,2,2) ezplot(FW) %fourier transform (magnitude) subplot(2,2,[3,4]) ezplot(theta) %fourier transform (phase)

Signals and Systems Lab

heaviside(t+5)-heaviside(t-5) sin(5 w)+conj(1/w sin(5 w)))2-(2/w sin(5 w)-2 conj(1/w sin(5 w)))2)1/2 1/2 (4 (1/w 1 10

0.5

0 0 0 5 10 -5 0 5 t w -i atanh(1/2 (2/w sin(5 w)-2 conj(1/w sin(5 w)))/(1/w sin(5 w)+conj(1/w sin(5 w)))) 1 -10 -5 0.5 0 -0.5 -1

-6

-4

-2

0 w

%Fourier transform of a sinc function


clear all clc syms t y=sinc(t); Y=Fourier(y); b=imag(Y); %Taking the imaginary part
1.5 0.5 FW=sqrt(a^2+b^2); theta=atan(b/a); 0

1/2 (4 (-1/2 heaviside(w-)+1/2 heaviside(w+ )+1/2 conj(-heaviside(w-)+heaviside(w+ )))2-(-heaviside(w-)+heaviside(w+ )-conj(-heav sin( t)/ /t a=real(Y); %Taking the real part2 1

%magnitude %phase

0.5 subplot(2,2,1) ezplot(y) %input Signal -0.5 0 subplot(2,2,2) -5 0 5 -5 0 5 ezplot(FW) %fourier transform (magnitude) t w subplot(2,2,[3,4]) eaviside(w-)+heaviside(w+ )-conj(-heaviside(w-)+heaviside(w+ )))/(-1/2 heaviside(w-)+1/2 heaviside(w+ )+1/2 conj(-heaviside(w-)+heavis ezplot(theta) %fourier transform (phase) 1 0.5 0 -0.5 -1

-6

-4

-2

0 w

Signals and Systems Lab

NB: Same codes will be applicable to have Laplace transform except the function laplace instead of Fourier.

Вам также может понравиться