How to edit the "▲" marks on the Nyquist plot and change only the lines in the negative frequency range to dashed lines
9 ビュー (過去 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 日
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 日
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 日
編集済み: Paul
2024 年 11 月 13 日
"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 で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!