简体   繁体   中英

How to Bode plot an array of transfer functions?

I have some transfer functions corresponding to an LLC converter. 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.

They will be plotted as 3 lines with the three colors red, green, blue.

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:

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')

描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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