MATLAB - drawing the pole-zero diagram of the system

Topic 1:
Known system function:
H ( s ) = s − 1 s 2 + 2 s + 2 H(s)=\frac{s-1}{s^{2}+2s+2}H(s)=s2+2s+2s1
Find the poles and zeros of the system and draw the poles and zeros distribution diagram.
roots :
roots(a) usually means solving the roots of a polynomial equation a, where a is a polynomial. Here, the coefficients of the numerator polynomial of the system equation are represented, that is, the poles of the system are being sought here. The root of a polynomial equation is the variable value that makes the polynomial equal to zero, and can also be understood as the zero point or solution of the polynomial.
markersize:
The 'markersize' parameter is used to specify the size of the marker, which is set to 12 here.
legend()
is used to add a legend to the graph to better illustrate the meaning of the data.
pzmap(b,a);
is used to draw a Pole-Zero Plot (Pole-Zero Plot), showing the distribution of the poles and zeros of the rational transfer function on the complex plane. Specifically, it uses MATLAB's pzmap function, passing the numerator coefficient vector b and denominator coefficient vector a of the rational transfer function as parameters to the function.
Two methods are used for drawing in the code for comparison.
Full code:

b=[1,-1];
a=[1,2,2];

ps=roots(a);
zs=roots(b);

subplot(121);
plot(real(zs),imag(zs),'o',real(ps),imag(ps),'x','markersize',12);
axis([-2,2,-2,2]);
grid;%绘制网格线
legend('零点','极点');
subplot(122);
pzmap(b,a);
axis([-2,2,-2,2]);

operation result:

Topic 2:
The known system functions are:
H 1 ( s ) = 1 s + 1 H1(s)=\frac{1}{s+1}H1(s)=s+11
H 2 ( s ) = 1 s 2 + 2 s + 17 H2(s)=\frac{1}{s^{2}+2s+17} H2(s)=s2+2s+171
Find the pole-zero distribution diagram of these systems and the impulse response of the system, and judge the stability of the system.
Following the above topic, this time we mainly use the pzmap function to solve the zero-pole point, and at the same time use the impluse function to find the impulse response.

a1=[1,1];
b1=[1];
subplot(221);
impulse(b1,a1);
axis([0,6,0,1]);
subplot(222);
pzmap(b1,a1);
axis([-2,2,-1,1]);

a2=[1,2,17];
b2=[1];
subplot(223);
impulse(b2,a2);
axis([0,5,-0.3,0.3]);
subplot(224);
pzmap(b2,a2);
axis([-5,5,-5,5]);

Running result:
insert image description here
Description: axis is used to determine the range of the horizontal and vertical coordinates, and you can select the appropriate range of horizontal and vertical coordinates for drawing according to the calculation results. In addition, impulse and pzmap have their own drawing functions, so there is no need to use plot to draw.

Guess you like

Origin blog.csdn.net/m0_46155417/article/details/129364222