How to edit the "▲" marks on the Nyquist plot and change only the lines in the negative frequency range to dashed lines
59 次查看(过去 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?
0 个评论
回答(2 个)
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 个评论
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
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!