How do i plot poles of three matrices using different marker for each matrix on same plot using either pzmap or pzplot?

1 visualizzazione (ultimi 30 giorni)
Given the following elements of matrix A, three matrices are intended to be generated using different variable D as D = 0, D = 4 and D = 70. The poles resulting from this matrices are to be plotted using different Marker, and the marker is inted to be bold, not necessarily big in size. I tried but im getting the error
''Assigning to 2 elements using a simple assignment statement is not supported. Consider using comma-separated list assignment''.
Any assistance would be highly appreciated.
Thank you
Ta1 = 24; Ta2 = 27; Ta3= 20;
H11 = -0.0641; H12 = 0.0359;
H21 = 0.1176; H22 = -0.2057;
H31 = 0.2077; H32 = 0.1961;
for D = [0 4 70]
A = [0 0 1 0 -1;0 0 0 1 -1;(-H11/Ta1) (-H12/Ta1) (-D/Ta1) 0 0;...
(-H21/Ta2) (-H22/Ta2) 0 (-D/Ta2) 0;(-H31/Ta3) (-H32/Ta3) 0 0 (-D/Ta3)];
Eig = eig(A);
a = Eig(1,1);
b = Eig(2,1);
c = Eig(3,1);
d = Eig(4,1);
e = Eig(5,1);
s = tf('s');
T = (1)/((s-a)*(s-b)*(s-c)*(s-d)*(s-e));
ax = gca;
P = pole(T);
if D == 0
pzmap(T)
PZP = findobj(ax, 'Tag', 'PZ_Pole');
PZP.Marker = 'v';
PZP.MarkerSize = 8;
PZP.Color = 'r';
end
hold on
if D == 7
pzmap(T);
PZP = findobj(ax, 'Tag', 'PZ_Pole');
PZP.Marker = 'd';
PZP.MarkerSize = 8;
PZP.Color = 'k';
end
hold on
if D == 70
pzmap(T);
PZP = findobj(ax, 'Tag', 'PZ_Pole');
PZP.Marker = '*';
PZP.MarkerSize = 8;
PZP.Color = 'y';
end
end

Risposte (1)

Paul
Paul il 21 Mag 2023
Modificato: Paul il 21 Mag 2023
Hi Kamilu,
The code calls pzmap twice in the D==70 case.
The code checks for a case with D == 7, but the second element through the loop is 4.
I think the error is caused by the fact that the pzmaps are being plot into the same axis, so the findobj command will return all of the PZ_Pole tagged objects created in the the axes, not just the one created in the current loop iteration.
Maybe pzplot would give you more direct control on how the poles and zeros are plotted for each case, instead of plotting them and then modifying for their properties.
Also, if the only objective is to plot the poles, why not just plot them using
plot(real(Eig),imag(Eig),...)
with the desired line specifications. Unless, of course, pzmap (or pzplot) is desired for other reasons.
  2 Commenti
Kamilu Sanusi
Kamilu Sanusi il 21 Mag 2023
@Paul, thank you for the advise, it is not necessary i use the pzmap. Please how can i modify the above code incorporating your suggestion to achieve the aim.
Paul
Paul il 21 Mag 2023
I gave the basic plot command. Check the doc page plot to see how to set marker sizes, marker colors, etc.

Accedi per commentare.

Categorie

Scopri di più su Mathematics and Optimization in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by