CODE:
clear all
alphap=2;
%passband attenuation in dB
alphas=20; %stopband attenuation in dB
wp=[.2*pi,.4*pi]; % passband freq. in radians
ws=[.1*pi,.5*pi]; % stopband freq. in radians
%to find cutoff freq. and order of the filter
[b,a]=butter(n,wn)
w=0:.01:pi;
[h,ph]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);plot(ph/pi,m);grid;
ylabel('Gain in dB');
Xlabel('NORMALISED FREQUENCY')
subplot(2,1,2);plot(ph/pi,an);grid
ylabel('phase in radians');
xlabel('noramlised frequency')
OUTPUT:
n = 4
wn = 0.1950
0.4082
b =0.0060 0
-0.0240 0 0.0359 0
-0.0240 0 0.0060
a = 1.0000
-3.8710 7.9699 -10.6417
10.0781 -6.8167 3.2579
-1.0044 0.1670
Hello, The code given above is showing error
ReplyDelete