clear all;
fs=40; f1=4; f2=6; f1s=3.5; f2s=6.5;
G0 = -Inf; G = 0; GB = -0.10; type = 3; Gs = -30; tol=eps;
w1=2*pi*f1/fs; w2=2*pi*f2/fs; w1s=2*pi*f1s/fs; w2s=2*pi*f2s/fs;
[w0,Dw] = bandedge(w1,w2,1); Dws = w2s-w1s;
Nexact = hpeqord(G0, G, GB, Gs, Dw, Dws, type),
N=ceil(Nexact)
[B,A,Bh,Ah] = hpeq(N, G0, G, GB, w0, Dw, type, Gs, tol)
f = linspace(0,20,1001); w = 2*pi*f/fs;
H = abs(fresp(B,A,w)).^2;
Gb = -3; Dwb = bandwidth(N,G0,G,GB,Gb,Dw,type,Gs);
[w1b,w2b] = bandedge(w0,Dwb); f1b = fs * w1b/2/pi; f2b = fs * w2b/2/pi;
figure;
plot(f,H,'r-', [f1,f2,f1b,f2b,f1s,f2s], 10.^([GB,GB,Gb,Gb,Gs,Gs]/10), 'b.');
ylim([0,1.05]); ytick(0:0.25:1);
xlim([0,20]); xtick(0:2:20);
title('Elliptic, Bandpass');
xlabel('{\it f} (kHz)'); ylabel('magnitude squared')
grid;
Nexact =
4.0308
N =
5
B =
0.1076 0 -0.1076 0 0
0.6927 -1.9076 2.6447 -1.9076 0.6927
0.2652 -0.7036 0.9561 -0.7036 0.2652
A =
1.0000 -1.2778 0.7848 0 0
1.0000 -2.7529 3.7913 -2.6836 0.9516
1.0000 -2.6548 3.4994 -2.3489 0.7864
Bh =
0.1076 0.1076 0
0.6927 -1.2791 0.6927
0.2652 -0.4523 0.2652
Ah =
1.0000 -0.7848 0
1.0000 -1.8452 0.9516
1.0000 -1.7083 0.7864