Professional Documents
Culture Documents
ID No:
Group:
Date:
WHERE
LAB 2
KNOWLEDGE
INSTRUMENTS REQUIRED:
Notes:
0
Experiment 1:
Use SCILAB to plot the Continuous Time Fourier Series Coefficient of a periodic signal
x(t) = sin (πt).
Source Code
clc
close
clear
V=1
t0 =1,T=1, w0 =2*3.14/T,P=1
t =0:0.01:3
f=V*abs( sin ( %pi *t)) //The Exponential Fourier series coefficient
disp ( 'The Exponential Fourier series coefficient are for n = -5 to 5' )
a=1
for n= -5:5
fr=f.* cos ( %pi *n*t/T)
Fr(a)= inttrap (t,fr)
fi=f.* sin ( %pi *n*t/T)
Fi(a)= inttrap (t,fi)
mag (a)=abs(Fr(a)+%i*Fi(a))
1
Experiment 2
Use SCILAB to plot the Fourier transform of a signal x(t) = cos (4πt).
Source Code
T1 = 0.5;
T = 4* T1;
Wo = 2* %pi /T1;
W = [-Wo ,0, Wo ];
ak = (2* %pi *Wo*T1/ %pi )/ sqrt ( -1);
XW = [-ak ,0, ak ];
ak1 = (2* %pi*Wo*T1/%pi);
XW1 =[ ak1 ,0, ak1 ];
clf ();
a = gca();
a.y_location ="origin";
a.x_location ="origin";
subplot (211);
plot2d (t, f1,5);
set_my_line_styles(1,3);
xlabel ("t" , "fontsize" , 3);
title ("Cos(4πt) " , " fontsize " , 7, "color" , "red")
//**********************************************************************
subplot(212);
plot2d3 ('gnn',W,XW1,2,style =6) ;
set_my_line_styles(1,3);
xlabel ( 'W in rad/sec' );
ylabel ("X(w) " , " fontsize " , 3, "color" , "blue");
title ( 'NAME and ID Number'," fontsize " , 7, "color" , "green" )
legends ( "CTFT of cos(4πt)" ,[2 ,6] , withbox =%f , opt ="ur" )
2
Write a comment and conclusion from the results of experiment 1 and 2