Created
October 17, 2019 09:06
-
-
Save geekykant/31c61513982d5875ef765c9a21e8315f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clc; | |
clear all; | |
close all; | |
rp = input('Enter the pass band ripple: '); | |
rs = input('Enter the stop band ripple: '); | |
wp = input('Enter the pass band freq: '); | |
ws = input('Enter the pass band freq: '); | |
fs = input('Enter the sampling freq: '); | |
w1= (2*wp)/fs; | |
display('w1'); | |
display(w1); | |
w2=(2*ws)/fs; | |
display('w2'); | |
display(w2); | |
[n,wn]= cheb2ord(w1,w2,rp,rs); | |
display('The order of filter n'); | |
display(n); | |
display(wn); | |
[b,a] = cheby2(n,rs,wn); | |
display('Numerator coefficients b'); | |
display(a); | |
w= 0:0.01:pi; | |
[h,on] = freqz(b,a,w); | |
m=20*log10(abs(h)); | |
an = angle(h); | |
display tf(b,a); | |
subplot(2,2,1); | |
plot(on/pi,m); | |
subplot(2,2,2); | |
plot(on/pi,an); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment