How to edit the "▲" marks on the Nyquist plot and change only the lines in the negative frequency range to dashed lines

58 次查看(过去 30 天)

Is there a way to change the size and color of the ▲ marks that appear when drawing a Nyquist diagram?
Is there a way to change thae style of line of the line in the negative frequency when drawing a Nyquist diagram?

回答(2 个)

Walter Roberson
Walter Roberson 2024-11-12,3:26
nqp = findobj(groot, 'type', 'nyquist');
npa = findobj(nqp, 'Tag', 'NyquistPositiveArrow');
npa.FaceColor = APPROPRIATE_RGB_TRIPLE;
npa.EdgeColor = APPROPRIATE_RGB_TRIPLE;
nna = findobj(nqp, 'Tag', 'NyquistNegativeArrow');
nna.FaceColor = APPROPRIATE_RGB_TRIPLE;
nna.EdgeColor = APPROPRIATE_RGB_TRIPLE;
To change the size, you have to change npa.Vertices and nna.Vertices to reflect new data-relative coordinates. Something like
npa_centroid = mean(npa.Vertices, 1);
npa.Vertices = npa_centroid + (npa.Vertices - npa_centroid) * SCALE_FACTOR;
  5 个评论
ayumi obitsu
ayumi obitsu 2024-11-13,2:02
Thanks for the reply.
The XData and YData are the real and imaginary parts of a complex function of frequency H(w). The OP wants the portion of H(w) corresponding to w < 0 to be dashed.
>>That is correct.
I found that it is not easy to edit the size and color of ▲, or to make the Nyquist diagram of the negative area frequencies dashed, both of which are not easy to do.
I will keep trying.
If you figure out how to do it, I would appreciate it if you could let me know.
Walter Roberson
Walter Roberson 2024-11-13,2:25
Setting color:
npa = findobj(groot, 'Tag', 'NyquistPositiveArrow');
npa.FaceColor = APPROPRIATE_RGB_TRIPLE;
npa.EdgeColor = APPROPRIATE_RGB_TRIPLE;
Setting size:
The internal representation of nyquist() plots does not draw the arrows as markers of any kind. The internal representation of nyquist() plots draws the arrows as patch() objects. I already posted code that should rescale the patch objects.

请先登录,再进行评论。


Paul
Paul 2024-11-13,3:08
编辑:Paul 2024-11-13,11:59
"Probably the easiest way to do this would be to use the output argument form of nyquist and then make the plot from the outputs w/ whatever styling is desired."
This doesn't give you all the bells and whistles of nyquist or nyquistplot, but it's a start. It uses @Walter Roberson's sleuthing to get the arrows.
I assumed that the 'PositiveArrow' applied for positive frequencies, and the 'NegativeArrow' for negative frequencies, but apparently that's not the case. I'll leave it to you to make the arrows however you want.
h = tf(1,[1 2 3 4]);
[hreal,himag,w] = nyquist(h);
hreal = squeeze(hreal);himag = squeeze(himag);
figure
hax = gca;
plot(hax,hreal,himag,'b-',hreal,-himag,'r--'),grid
hold on
plot(hax,-1,0,'r+','MarkerSize',15)
xlim('padded')
hf = figure('Visible','off');
hny = nyquistplot(gca,h);
harrow = copyobj([findobj(hny, 'Tag', 'NyquistPositiveArrow'),findobj(hny, 'Tag', 'NyquistNegativeArrow')],hax);
harrow(1).FaceColor = 'b';harrow(1).EdgeColor = 'b';
harrow(2).FaceColor = 'r';harrow(2).EdgeColor = 'r';
delete(hf);clear hf hny

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by