增加奈奎斯特图中箭头的大小?
Increasing size of arrows in Nyquist plot?
有谁知道如何增加由 MATLAB Control System Toolbox 生成的奈奎斯特图中箭头的大小(同时保持线宽和图中的其他所有内容相同)?
I noticed that you also asked the same question in MATLAB
Central. Please make sure to refer other visitors to this answer if
you found it useful.
先是坏消息
MATLAB 控制系统工具箱提供了函数nyquist
and nyquistplot
来绘制动态系统模型频率响应的奈奎斯特图。
尽管这些函数允许 a certain level of graphical customization (units, grids, labels and basic LineSpec), they don't allow to alter the size of the arrows that appear by default in the Nyquist plot (you can read more about this here and here).
好消息(破解时间!)
我开始探索奈奎斯特图的对象层次结构,并意识到绘制的箭头是 patch
个对象。
我怎么注意到的?
首先我生成了一个样本奈奎斯特图:
sys = tf([2 5 1],[1 2 3]); % System transfer function.
nyquist(sys); % Nyquist plot.
那我运行来个暴力测试!
以下测试遍历奈奎斯特图 window 的每个 graphics object 并在每次迭代中闪烁一个元素。通过这种方式,当箭头开始闪烁时,我能够直观地识别链接到箭头的对象。
h = findall(gcf); % Find all graphics objects including hidden ones.
t = 0.5; % Time interval.
for i = 1:length(h) % Loop through every object handle.
disp(i); % Display handle array index.
pause(t); % Pause for t seconds.
status = h(i).Visible; % Copy Visible property.
if strcmp(status, 'on') % If Visible = 'on' --> Visible = 'off'
h(i).Visible = 'off';
else % If Visible = 'off' --> Visible = 'on'
h(i).Visible = 'on';
end
pause(t); % Pause for t seconds.
h(i).Visible = status; % Restore original Visible property.
pause(t); % Pause for t seconds.
end
disp('Finished!'); % Display Finished!
经过运行这个测试,我发现h(196)
和h(197)
是奈奎斯特图的两个箭头,它们是patch
个对象
更改 'LineWidth'
属性 是下一个合乎逻辑的步骤。为了更改箭头的大小,您只需执行以下代码即可:
sys = tf([2 5 1],[1 2 3]); % System transfer function.
nyquist(sys); % Nyquist plot.
h = findall(gcf, 'Type', 'Patch'); % Find all patch objects.
for i = 1:length(h) % Loop through every patch object handle.
h(i).LineWidth = 4; % Set the new LineWidth value.
end
这是结果:
希望您喜欢这次冒险! :D
有谁知道如何增加由 MATLAB Control System Toolbox 生成的奈奎斯特图中箭头的大小(同时保持线宽和图中的其他所有内容相同)?
I noticed that you also asked the same question in MATLAB Central. Please make sure to refer other visitors to this answer if you found it useful.
先是坏消息
MATLAB 控制系统工具箱提供了函数nyquist
and nyquistplot
来绘制动态系统模型频率响应的奈奎斯特图。
尽管这些函数允许 a certain level of graphical customization (units, grids, labels and basic LineSpec), they don't allow to alter the size of the arrows that appear by default in the Nyquist plot (you can read more about this here and here).
好消息(破解时间!)
我开始探索奈奎斯特图的对象层次结构,并意识到绘制的箭头是 patch
个对象。
我怎么注意到的?
首先我生成了一个样本奈奎斯特图:
sys = tf([2 5 1],[1 2 3]); % System transfer function.
nyquist(sys); % Nyquist plot.
那我运行来个暴力测试!
以下测试遍历奈奎斯特图 window 的每个 graphics object 并在每次迭代中闪烁一个元素。通过这种方式,当箭头开始闪烁时,我能够直观地识别链接到箭头的对象。
h = findall(gcf); % Find all graphics objects including hidden ones.
t = 0.5; % Time interval.
for i = 1:length(h) % Loop through every object handle.
disp(i); % Display handle array index.
pause(t); % Pause for t seconds.
status = h(i).Visible; % Copy Visible property.
if strcmp(status, 'on') % If Visible = 'on' --> Visible = 'off'
h(i).Visible = 'off';
else % If Visible = 'off' --> Visible = 'on'
h(i).Visible = 'on';
end
pause(t); % Pause for t seconds.
h(i).Visible = status; % Restore original Visible property.
pause(t); % Pause for t seconds.
end
disp('Finished!'); % Display Finished!
经过运行这个测试,我发现h(196)
和h(197)
是奈奎斯特图的两个箭头,它们是patch
个对象
更改 'LineWidth'
属性 是下一个合乎逻辑的步骤。为了更改箭头的大小,您只需执行以下代码即可:
sys = tf([2 5 1],[1 2 3]); % System transfer function.
nyquist(sys); % Nyquist plot.
h = findall(gcf, 'Type', 'Patch'); % Find all patch objects.
for i = 1:length(h) % Loop through every patch object handle.
h(i).LineWidth = 4; % Set the new LineWidth value.
end
这是结果:
希望您喜欢这次冒险! :D