简体   繁体   English

如何波特图绘制传递函数数组?

[英]How to Bode plot an array of transfer functions?

I have some transfer functions corresponding to an LLC converter.我有一些对应于 LLC 转换器的传递函数。 Each one is different, I'm changing a single parameter to visualize the changes in the frequency response.每个都不同,我正在更改单个参数以可视化频率响应的变化。 I have something like this:我有这样的事情:

V(1)=Voutput;
V(2)=Voutput2;
V(3)=Voutput3;

Then I plot them using:然后我使用以下方法绘制它们:

figure(1)
optsV = bodeoptions('cstprefs');
optsV.FreqUnits = 'kHz';
bode(V, optsV)

The problem is that every transfer function is being plotted in a different chart:问题是每个传递函数都被绘制在不同的图表中:

在此处输入图片说明

How can I plot them in a single chart?如何将它们绘制在单个图表中?

Use something like使用类似的东西

bode(V(1),'r',V(2),'g',V(3),'b', optsV)

where V1,V2,V3 are your various transfer functions.其中V1,V2,V3是您的各种传递函数。

They will be plotted as 3 lines with the three colors red, green, blue.它们将被绘制为 3 条线,分别带有红、绿、蓝三种颜色。

EDIT, in reply to the comment: if as you write in the comments they are very many, you can create the figure, call hold on , and plot all the transfer functions in a for loop, something like this:编辑,回复评论:如果你在评论中写的很多,你可以创建图形,调用hold on ,并在 for 循环中绘制所有传递函数,如下所示:

first_tf = tf(1,[1,1]);
%your example of many TF.
V = [first_tf,2*first_tf,3*first_tf];
figure
hold on

for j=1:length(tfdata(V))
    bode(V(j))
end

With output like:输出如下:在此处输入图片说明

You can use the following and put all of them in the same command:您可以使用以下命令并将它们全部放在同一个命令中:

bode(V(1),V(2),V(3), optsV)

If you want to use a loop to automatically plot all of the transfer functions you can use the following code:如果要使用循环自动绘制所有传递函数,可以使用以下代码:

for i = 1:size(V,2)
    bode(V(i), optsV)
    hold on
end

Here is a short demonstration:这是一个简短的演示:

V(1)=tf([1 0 0],[1 1]);
V(2)=tf([1 2 0],[1 1]);
V(3)=tf([1 1 0],[1 1]);

figure(1)
optsV = bodeoptions('cstprefs');
optsV.FreqUnits = 'kHz';

bode(V(1),V(2),V(3), optsV)
legend('V1','V2','V3')

描述

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

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