简体   繁体   English

如何以编程方式找到伯德图中给定相位的幅度和频率?

[英]How to programatically find the magnitude and frequency for a given phase in a bode plot?

If I have a Plant let's say 如果我有植物,可以说

Gp(s) = 1/(s+1) Gp(s)= 1 /(s + 1)

I can find the Phase Margin 我可以找到相位裕度

Using MATLAB commands 使用MATLAB命令

Gp = tf([1],[1 1]);
[G P] = margin(Gp);

My question is what if I want to know the phase over frequency in a specific Gain Over Frequency. 我的问题是,如果我想知道特定增益超频中的相位超频怎么办。 How do I find it without looking to bode plot? 我如何找到它而不希望预示情节?

Usually I find it by the command bode(Gp) and move the mouse over the specific gain that I want to know the phase margin on it. 通常,我可以通过命令bode(Gp)找到它,然后将鼠标移到我想知道其相位裕度的特定增益上。

For my previous example The Gain Over Frequency is 0.363 at -20 Phase Over Frequency. 对于我之前的示例,-20相过频时的增益过频为0.363。

How do I write it as a command not looking in the bode diagram? 我如何将其编写为不在伯德图中查找的命令?

Thanks in advance 提前致谢

It seems you misunderstood what Gain Over Frequency and phase margin actually means, and it is not the place to explain it. 您似乎误解了“ 增益”和“ 相位余量”的实际含义,而不是解释它的地方。 What I assume you actually want, is a way to evaluate a bode-plot without clicking at it. 我认为您真正想要的是一种无需单击即可评估波特图的方法。 Eg you want to know magnitude and frequency at the point of -20 phase . 例如,您想知道-20 点的大小频率

Let's have a look at these three cases: 让我们看一下这三种情况:


Case 1: you know the frequency and you're searching for magnitude and phase 情况1:您知道频率,并且正在搜索幅度和相位

The easiest case: 最简单的情况:

w = 0.363;                 % specify given frequency
[mag,phase] = bode(Gp,w)   % output of according magnitude and phase

returns: 收益:

mag =

    0.9400


phase =

  -19.9509

Case 2: you want to know magnitude and frequency for a certain phase 情况2:您想知道某个相位的幅度和频率

p = -20;
[mag,phase,wout] = bode(Gp);

mag_p = interp1( squeeze(phase), squeeze(mag), p)
w_p   = interp1( squeeze(phase), wout, p)

returns: 收益:

mag_p =

    0.9394

w_p =

    0.3642

Case 3: you want to know phase and frequency for a certain magnitude 情况3:您想知道一定幅度的相位和频率

m = 0.9394;
[mag,phase,wout] = bode(Gp);

phase_m = interp1( squeeze(mag), squeeze(phase), m)
w_m     = interp1( squeeze(mag), wout, m)

returns: 收益:

phase_m =

  -19.9998


w_m =

    0.3642

The squeeze command is necessary, because bode output a 1x1x... matrix for phase and magnitude, however. squeeze命令是必需的,因为1x1x...输出一个1x1x...矩阵用于相位和幅度。 You also may use different interpolation methods of interp1 . 您还可以使用interp1不同插值方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM