% Pole-Zero Demonstration 3D Plot % F(s)=(s+20)/(s^2 + 100) % The magnitude is limited to 1 to make the plot better % Authored by Jeffrey N. Denenberg on 8 April 2004 % Establish the function of s % B is the numerator and A is the denominator B = [1,20] A = [1,0,100] % Set up the values for s S=zeros(50,50); for n=1:50 for m=1:50 S(n,m)=(n-25)+j*(m-25); end end % Populate F(s) F=zeros(50,50); for n=1:50 for m=1:50 s=S(n,m); numerator=B(1)*s + B(2); denominator=A(1)*s^2 + A(2)*s + A(3); F(n,m)=numerator/denominator; if abs(F(n,m))>1 F(n,m)=1; end end end % Plot the magnitude of F(s) in 3D X=-24:25; Y=-24:25; mesh(X,Y,abs(F)); % Done