Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fr(r1, r2, r3, p1, p2, p3)
- p = poly([r1*exp(i*p1) r2*exp(i*p2) r3*exp(i*p3) r1*exp(-i*p1) r2*exp(-i*p2) r3*exp(-i*p3)]);
- f = ((1:100001)-1)*2*pi/100000;
- ef = exp(i*f);
- resp = polyval(p,ef);
- figure
- plot(f, 20*log10(abs(resp)))
- title('frequency response of filter')
- xlim([0, pi])
- figure
- plot(f, angle(resp))
- title('phase response of filter')
- xlim([0, pi])
- figure
- freqz(p)
- end
- function ir(r1,r2,r3,p1,p2,p3)
- p = poly([r1*exp(i*p1) r2*exp(i*p2) r3*exp(i*p3) r1*exp(-i*p1) r2*exp(-i*p2) r3*exp(-i*p3)]);
- figure
- impz(p)
- end
- function frr(r1, r2, r3, p1, p2, p3, ndigits)
- p = poly([r1*exp(i*p1) r2*exp(i*p2) r3*exp(i*p3) r1*exp(-i*p1) r2*exp(-i*p2) r3*exp(-i*p3)]);
- p = round(p, ndigits);
- f = ((1:100001)-1)*2*pi/100000;
- ef = exp(i*f);
- resp = polyval(p,ef);
- figure
- zplane(roots(p), [])
- figure
- freqz(p)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement