How to edit the "▲" marks on the Nyquist plot and change only the lines in the negative frequency range to dashed lines
65 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Walter Roberson
on 12 Nov 2024 at 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 Comments
Walter Roberson
on 13 Nov 2024 at 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
on 13 Nov 2024 at 3:08
Edited: Paul
on 13 Nov 2024 at 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 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!