blob: aed9a6ed3ec981aa9d1aade0663e9ed7daf22656 (
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
|
a=0.5;b=1;
n=0:50;
h=b*(a^n);
//Discrete-Time Fourier transform
K=500;
k=-250:1:250;
w=%pi*k/K;
H=h*exp(-%i*n'*w);
//caluculation of phase and magnitude of h(z)
[phase_H,m]=phasemag(H);
H=abs(H);
a=gca();
subplot(2,1,1);
a.y_location="origin";
plot2d(w/%pi,H);
xlabel('Frequency in radians')
ylabel('abs(H)')
title('magnitude Response')
subplot(2,1,2);
a=gca();
a.x_location="origin";
a.y_location="origin";
plot2d(w/(2*%pi),phase_H)
xlabel('Frequency in Radians');
ylabel('<(H)')
title('Phase Response'))
|