Search Here

Custom Search

Two

Monday 16 May 2011

MATLAB CODE FOR LOW PASS BUTTERWORTH IIR FILTER USING BILINEAR TRANSFORM 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=2*Fs*tan(Wp/2);
Omgs=2*Fs*tan(Ws/2);                              
[N,W]=buttord(Omgp,Omgs,Ap,As,'s');      
[num,den]=butter(N,Ap,W,'low','s');      
[B,A]=bilinear(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');

8 comments:

  1. Dear I need a Matlab code for IIR Filter with phase and gain matching. You can say it Adaptive IIR filter. This filter should match its phase and gain with the unknown system's Phase and gain. I shall be grateful for your help.

    ReplyDelete
  2. Dear I need a Matlab code for IIR Filter with phase and gain matching. You can say it Adaptive IIR filter. This filter should match its phase and gain with the unknown system's Phase and gain. I shall be grateful for your help.
    my email ID is: tak_iiec@yahoo.com

    ReplyDelete
  3. What to input to get the graphical result

    ReplyDelete
  4. What to input to get the graphical result

    ReplyDelete

  5. 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=2*Fs*tan(Wp/2);



    Omgs=2*Fs*tan(Ws/2);



    [N,W]=buttord(Omgp,Omgs,Ap,As,'s');



    [num,den]=butter(N,Ap,W,'low','s');



    [B,A]=bilinear(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');

    ReplyDelete
  6. Hello, can you help me with the code for filtering a raw ECG signal using Butterworth 4th order low pass filter at 70 Hertz?

    ReplyDelete
  7. The Magic Table at Mohegan Sun - JTG Hub
    Tickets for The Magic 성남 출장샵 Table at Mohegan Sun are 고양 출장마사지 available now. Click to enjoy 제천 출장안마 a 포천 출장마사지 wide range of table 과천 출장마사지 games, and get a $50 free pass to Mohegan Sun,

    ReplyDelete

http://astore.amazon.com/matlabcodes-20