How to edit the "▲" marks on the Nyquist plot and change only the lines in the negative frequency range to dashed lines
60 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Walter Roberson
am 12 Nov. 2024 um 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 Kommentare
Walter Roberson
am 13 Nov. 2024 um 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
am 13 Nov. 2024 um 3:08
Bearbeitet: Paul
am 13 Nov. 2024 um 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 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!