remove annotations from diskmarginplot

3 vues (au cours des 30 derniers jours)
Muhammad
Muhammad le 31 Mar 2023
Commenté : Muhammad le 3 Avr 2023
Hey guys! I want to show a system's stability by giving the system's diskmargin by some skew variations. To give a smooth shape of the stable area of the system in complex plane, i stacked all the diskmargin variation by using this script:
% Plant Model
f = pos_motor;
% Plant Diskmargin
s_DOL = -100:1:100;
figure(1)
hold on
for i = 1:numel(s_DOL)
DOL = diskmargin(f,s_DOL(i));
diskmarginplot(DOL.GainMargin,'disk')
end
hold off
And this results in a figure:
The description for each diskmargin on the figure is quite a bother. I searched for the solution in function diskmarginoptions but with no success.
Hope anyone can help! Thanks

Réponse acceptée

Paul
Paul le 3 Avr 2023
Hi Muhammad,
Something like this might work, either inside or after the loop. Some experimentation may be needed.
Disk margin plot with annotations.
L = tf(25,[1 10 10 10]);
DM = diskmargin(L);
DGM = DM.GainMargin;
DPM = DM.PhaseMargin;
diskmarginplot(DGM)
Copy the plot to see how it changes
copyobj(gca,figure);
Find the text objects
h = findobj(get(gca,'Children'),'Type','Text')
h =
2×1 Text array: Text (DPM = 26 deg) Text (DGM = [0.63,1.6])
Delete them
delete(h)
  1 commentaire
Muhammad
Muhammad le 3 Avr 2023
Thanks for your help! I got this working by editing the script to:
% Plant Model
f = pos_motor;
% Plant Diskmargin
s_DOL = -100:1:100;
figure(1)
hold on
for i = 1:numel(s_DOL)
DOL = diskmargin(f,s_DOL(i));
diskmarginplot(DOL.GainMargin,'disk')
end
hold off
line_ann = findobj(get(gca,'Children'),'Type','Line');
text_ann = findobj(get(gca,'Children'),'Type','Text');
delete(line_ann(2:end))
delete(text_ann)
Results in:

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Disk-Based Gain and Phase Margins dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by