rho = 0.9, theta = 0.1
[b,a] = dampc(0.9,0.1); plotf(b,a)
function [b,a] = DAMPC(rho,theta) % DAMPC % % Damped cosine % % DAMPC(rho,theta) % re = rho*cos(2*pi*theta); b = [1 -re]; a = [1 -2*re rho*rho];
rho = 0.9, theta = 0.1
[b,a] = damps(0.9,0.1); plotf(b,a)
function [b,a] = DAMPS(rho,theta) % DAMPS % % Damped sine % % DAMPS(rho,theta) % re = rho*cos(2*pi*theta); si = rho*sin(2*pi*theta); b = [0 si]; a = [1 -2*re rho*rho];
plotf(1,a)
function PLOTF(b,a) % % PLOTF % % generates set of plots for rational transfer function % defined by a set of zeros and poles. % % PLOTF(b,a) [z,p,k] = tf2zp(b,a); [h,w] = freqz(b,a,2*pi*linspace(-0.5,0.5,100)); subplot(2,2,1); plot(w/pi,abs(h),'k'); grid xlabel 'Normalized frequency (Nyquist == 1)' ylabel 'Magnitude response' subplot(2,2,3); zplane(z,p); subplot(2,2,2); phase = unwrap(angle(h))/pi; plot(w/pi,phase,'k'); grid xlabel 'Normalized frequency (Nyquist == 1)' ylabel 'Phase (divided by \pi)' subplot(2,2,4) u = 2*pi*[-0.5: 0.001: 0.5]; plot(freqz(b,a,u),'k'); hold on; u = 2*pi*[-0.5: 0.1: 0.5]; plot(freqz(b,a,u),'ko'); grid axis square axis equal xlabel 'Real' ylabel 'Imag' hold off;
Maintained by John Loomis, last updated 23 Oct 1997