ZeroPole - Elliptic

 

 

 

 

 

Followings are the code that I wrote in Octave to creates all the plots shown in this page. You may copy these code and play with these codes. Change variables and try yourself until you get your own intuitive understanding.

 

< Code 1 >

 

np = 10;

n = 3;

b = n*0.025;

r = 0.8;

 

pList = [];

offset = pi/7;

thStart = pi/2 + offset;

thEnd = 3*pi/2 - offset;

thStep = (thEnd-thStart)/(np-1);

thList = thStart:thStep:thEnd;

 

zList = [0+1.25*j ...

         0-1.25*j ...

         0+1.75*j ...

         0-1.75*j ];

 

for th = thList

   pList = [pList r*(b*cos(th)+sin(th)*j)];

end  

 

re = -2:.025:2;

im = -2:.025:2;

[X,Y] = meshgrid(re,im);

s = (X + Y*j);

s_jw = (0 + Y*j);

 

num = ((0*X+1) + (0*Y+1)*j);

for i = 1:length(zList)

  num = num .* (s .+ zList(i));

end;

 

den = ((0*X+1) + (0*Y+1)*j);

for i = 1:length(pList)

  den = den .* (s .+ pList(i));

end;  

 

tf = num ./ den;

 

num = ((0*X+1) + (0*Y+1)*j);

for i = 1:length(zList)

  num = num .* (s_jw .+ zList(i));

end;

 

den = ((0*X+1) + (0*Y+1)*j);

for i = 1:length(pList)

  den = den .* (s_jw .+ pList(i));

end;

 

tf_jw = num ./ den;  

 

 

Zabs = abs(tf);

Zabs = 10 * log10(Zabs);

Zarg = arg(tf );

Zw = abs(tf_jw);

Zw = 10 * log10(Zw);

Zwarg = arg(tf_jw );

 

 

zmax = 60;

 

hFig = figure(1,'Position',[300 300 700 500]);

 

subplot(2,2,1);

plot(-real(pList),-imag(pList),'rx','markersize',8);

hold on;

plot(-real(zList),-imag(zList),'ro','markersize',8);

plot(cos(0:pi/20:2*pi),sin(0:pi/20:2*pi),'k-');

hold off;

axis([-2 2 -2 2]);

daspect([1 1]);

grid on;

 

 

subplot(2,2,2);

surface(X,Y,Zabs,'edgecolor','none');

axis([re(1) re(end) im(1) im(end) -zmax zmax]);

hold on;

plot3(X.*0,Y,Zw, 'linewidth',3,'color','k');

hold off;

view(0,90);

caxis([-zmax zmax]);

colormap(hsv(200));

 

 

subplot(2,2,3);

surface(X,Y,Zabs,'edgecolor','none');

axis([re(1) re(end) im(1) im(end) -zmax zmax]);

hold on;

plot3(X.*0,Y,Zw, 'linewidth',3,'color','k');

hold off;

view(-30,15);

caxis([-zmax zmax]);

colormap(hsv(200));

title('Transfer Function in dB');

 

 

subplot(2,2,4);

surface(X,Y,Zabs,'edgecolor','none');

axis([0 re(end) im(1) im(end) -20 zmax]);

hold on;

plot3(X.*0,Y,Zw, 'linewidth',3,'color','k');

hold off;

view(-90,10);

caxis([-zmax zmax]);

colormap(hsv(200));

title('Transfer Function cut at s=jwt');