> Design Butterworth and Chebyshev Filter using Matlab Code - TECH UPDATE

Design Butterworth and Chebyshev Filter using Matlab Code

In this article, I am showing the article on how to design Butterworth Filter and Chebyshev Filter using Matlab Code.




Matlab code for designing Butterworth Filter :


clc;
clear all;
close all;
rp = input('enter the passband atteunuation ');
rs = input('enter the stopband attenuation ');
wp = input('enter the passband frequency ');
ws = input('enter the stopband frequency ');
[n,wn] = buttord(wp,ws,rp,rs,'s');
display(n);
display(wn);
[z,p,k] = buttap(n);
display(z);
display(p);
display(k);
[b,a] = butter(n,1,'low','s');
display(b);
display(a);
[bt,at] = lp2lp(b,a,wn);
display(bt);
display(at);
H = tf(b,a);
display(H);
y = logspace(-10,10);
freqs(bt,at,y);


Chebyshev Filter using Matlab : 


clc;
clear all;
close all;
rp = input('enter the input attenuation ');
rs = input('enter the stop band attenuation ');
wp = input('enter the passband frequency ');
ws = input('enter the stopband frequency ');
[n,wn] = cheb1ord(wp,ws,rp,rs,'s');
display(n);
display(wn);
[z,p,k] = cheb1ap(n,rp);
display(z);
display(p);
display(k);
[b,a] = cheby1(n,rp,1,'low','s');
display(b);
display(a);
h = tf(b,a);
display(h);
[bt,at] = lp2lp(b,a,wn);
display(bt);
display(at);
y = logspace(-10,10);
freqs(bt,at,y);



Design Butterworth and Chebyshev Filter using Matlab Code Design Butterworth and Chebyshev Filter using Matlab Code Reviewed by TECH UPDATE on November 15, 2019 Rating: 5

No comments:

Powered by Blogger.