필터 지우기
필터 지우기

How to edit the red "+" marks on the Nyquist plot

조회 수: 55 (최근 30일)
ayumi obitsu
ayumi obitsu 2024년 7월 5일 9:16
댓글: Steven Lord 2024년 7월 9일 14:04
Is there a way to change the thickness and color of the red + marks that appear when drawing a Nyquist diagram?
  댓글 수: 1
Aquatris
Aquatris 2024년 7월 5일 11:56
are you talking about the red + sign on the -1 point?

댓글을 달려면 로그인하십시오.

채택된 답변

Voss
Voss 2024년 7월 5일 12:22
H = tf([2 5 1],[1 2 3]);
nyquist(H)
h = findall(gcf(),'Type','line')
h =
5x1 Line array: Line Line Line Line Line
mkr = get(h,'Marker')
mkr = 5x1 cell array
{'+' } {'none'} {'none'} {'none'} {'none'}
h = h(strcmp(mkr,'+'));
h.LineWidth = 5;
h.Color = [0 1 0];
h.MarkerSize = 20;
  댓글 수: 3
Voss
Voss 2024년 7월 9일 13:40
You're welcome!
Regarding the line of code you asked about, before that line is executed, h contains all the line objects in the figure. That line of code compares the marker of each line object to '+' and keeps only the line objects whose marker is '+', so that afterwards h contains only those line objects whose marker is '+'.
Steven Lord
Steven Lord 2024년 7월 9일 14:04
A slightly simpler approach would be to directly findobj all objects whose Marker property is '+'.
H = tf([2 5 1],[1 2 3]);
nyquist(H)
h = findall(gcf(),'Marker', '+')
h =
Line with properties: Color: [1 0 0] LineStyle: '-' LineWidth: 0.5000 Marker: '+' MarkerSize: 6 MarkerFaceColor: 'none' XData: -1 YData: 0 ZData: -10 Use GET to show all properties
The properties (specifically Color, Marker, XData, and YData) indicate that this is the "line" that is the red + symbol. This avoids the strcmp call.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Umar
Umar 2024년 7월 5일 12:01

Hi Ayumi,

To change the thickness and color of the red + marks in a Nyquist diagram, you can modify the properties of the plot after generating it. Below is an example illustrating how to achieve this customization. So, first, I will create a transfer function G as an example.Next, generate the Nyquist plot using the nyquist function. Afterwards, access the current figure handle and find all lines with a red color (indicating the + marks). Finally, we set the line width to 2 and change the color to blue for better visibility.

>> % Create a transfer function G = tf([1], [1, 2, 1]);

% Generate the Nyquist plot figure; nyquist(G);

% Access the current figure and set properties of the red + marks h = gcf; % Get current figure handle redPlusMarks = findall(h, 'Type', 'line', 'Color', [1 0 0]); % Find red lines set(redPlusMarks, 'LineWidth', 2); % Set line width to 2 set(redPlusMarks, 'Color', [0 0 1]); % Set color to blue

Please see attached plot as reference.

By following this approach, you can easily customize the appearance of the red + marks in Nyquist diagrams according to your preferences.

  댓글 수: 1
ayumi obitsu
ayumi obitsu 2024년 7월 9일 7:06
Mr.Umar
Thank you for your reply.
I was able to successfully change the color and thickness of the + mark.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by