Search Here

Custom Search

Two

Showing posts with label IIT. Show all posts
Showing posts with label IIT. Show all posts

Monday, 16 May 2011

MATLAB CODE FOR LOW PASS BUTTERWORTH IIR FILTER USING IIT TECHNIQUE.


clc;
clear all;
close all;

Ap=input('Enter the passband ripple in db:\n');
As=input('Enter the stopband attenuation in db:\n');

Wp=input('Enter the pass band edge frequency in rad:\n');
Ws=input('Enter the stop band edge frequency in rad:\n');
Fs=input('Enter sampling frequency in Hz:\n');

Omgp=Wp*Fs;
Omgs=Ws*Fs;                              
[N,W]=buttord(Omgp,Omgs,Ap,As,'s');      
[num,den]=butter(N,Ap,W,'low','s');      
[B,A]=impinvar(num,den,Fs);              

w=0:0.01:pi;
[h,ph]=freqz(B,A,w);                    
m=20*log(abs(h));
an=angle(h);
subplot(211);
plot(ph/pi,m);                            
grid;
xlabel('Frequency in Hz');
ylabel('Gain in db');
title('Frequency response of the Chebyshev filter');
subplot(212);
plot(ph/pi,an);                            
grid;
ylabel('Phase in rad');
xlabel('Frequency in Hz');

Sunday, 15 May 2011

MATLAB CODE FOR LOW PASS CHEBYSHEV IIR FILTER USING IIT TECHNIQUE.

clc;
clear all;
close all;

Ap=input('Enter the passband ripple in db:\n');
As=input('Enter the stopband attenuation in db:\n');

Wp=input('Enter the pass band edge frequency in rad:\n');
Ws=input('Enter the stop band edge frequency in rad:\n');
Fs=input('Enter sampling frequency in Hz:\n');

Omgp=Wp*Fs;
Omgs=Ws*Fs;                              
[N,W]=cheb1ord(Omgp,Omgs,Ap,As,'s');      
[num,den]=cheby1(N,Ap,W,'low','s');      
[B,A]=impinvar(num,den,Fs);              

w=0:0.01:pi;
[h,ph]=freqz(B,A,w);                    
m=20*log(abs(h));
an=angle(h);
subplot(211);
plot(ph/pi,m);                            
grid;
xlabel('Frequency in Hz');
ylabel('Gain in db');
title('Frequency response of the Chebyshev filter');
subplot(212);
plot(ph/pi,an);                            
grid;
ylabel('Phase in rad');
xlabel('Frequency in Hz');
http://astore.amazon.com/matlabcodes-20