blob: f1dfa0b8ac61bf9e396fc5414a3bc8549fea2cf6 (
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
|
clc;
clear all;
//chapter 3
//page no 85
//example 3.4
A=20; //Volts
T=1*10^-3; //seconds
f=[-3/T:3/T]; //in kHz
Vf=[]
for i=1:length(f)
if f(i)==0 then
Vf=[Vf A*T];
else
Vf=[Vf A*T*sin(%pi*f(i)*T)/(%pi*f(i)*T)];
end
end
clf;
plot2d(f,Vf,[5])
a=gca(); // Handle on axes entity
a.x_location = "origin";
a.y_location = "origin";
xtitle('Amplitude Spectrum','f,Hz','V(f)');
xgrid
|