2015-04-06 52 views
0

有人可以告诉我最后一个剧情指令如何在后续剧本中起作用?Plot in child(Matlab)

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; 

我试图为截止频率的水平线添加到我的波特图(幅度图),但我无法弄清楚如何做到这一点。当前的代码为我添加了一条垂直线。

回答

1

的问题是关于线

plot([1 1], [-20 20], 'r') 

这是一个简单的绘图命令。一般情况下,你使用

plot(x,y) 

这里是相同的:x维矢量是[1, 1]y维矢量为[-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;,所以波特图也不会消失。

+0

更深入的比其他的答案。+1。 – rayryeng 2015-04-06 14:54:43

0

变化类似于此的最后一个阴谋代码:

plot([1 10], [-20 -20], 'r') 

参考plot和一些例子努力得到它是如何工作的想法。