summaryrefslogtreecommitdiff
path: root/2414/CH3/EX3.7/Ex3_7.sce
blob: 9a827eaa819aaf7c9bd5e0dcd20d5e6d0f420af8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
clc;
clear all;
//chapter 3
//page no 89
//example 3.7
A=1;    //arbitrary vaule
T=(1+4)*10^-3;    //period in seconds
tau=1*10^-3;   //pulse width in second
fc=30*10^6;    //centre frequency in Hz
d=tau/T;        //duty cycle
f1=1/T;        //Fundamental frequency in Hz

//for plot
n=[-14:15];    //in Hz
Vf=[]
for i=1:length(n)
    if n(i)==0 then
        Vf(i*200)=A*d;
    else
       Vf(i*200)=A*d*sin(%pi*d*n(i))/(%pi*d*n(i)) 
    end
      
end
f=-3000:3000-1
f=f+fc;    //Shifting by fc
f=f*10^-6;   //in MHz
clf;
plot2d(f,Vf,[5])
xtitle('Amplitude Spectrum','f,MHz','Vn');
xgrid