有人可以告诉我以下脚本中的最后一个绘图命令如何工作吗?
close all;
s=tf('s');
sys1 = 5/(s+5);
sys2=exp(-1*s);
G=ss(sys1)*ss(sys2);
opts = bodeoptions('cstprefs');
opts.Grid= 'ON';
% create a figure and get the handle of the figure
figHnd = figure;
bode(G,opts)
% get and display the children handles of the figure
childrenHnd =get(figHnd, 'Children');
% select magnitude plot and plot a line
axes(childrenHnd(3));
hold on;
plot([1 1], [-20 20], 'r')
hold off;
我试图在我的Bode图(幅度图)上添加一条截止频率的水平线,但我不知道该怎么做。当前代码为我添加了一条垂直线。
问题是关于生产线
plot([1 1], [-20 20], 'r')
这是一个简单的绘图命令。通常,您使用
plot(x,y)
这里是一样的:x
-vector是[1, 1]
和y
-vector是[-20, 20]
。因此,您可以从画一条线(1,-20)
到(1,20)
。最后一部分(r
)仅指定颜色,即红色。这正是您在波特图中可以看到的。
要创建一条水平线,例如从(10^-1, -20)
到,(10^0, -20)
您可以类似地绘制
plot([10^-1, 10^0], [-20, -20], 'r');
(不要忘记将其放在内hold on; ... hold off;
,因此不会删除预示图。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句