Surf respresentation of a transfer function depending on the frequency and the gain of the feedback

1 visualizzazione (ultimi 30 giorni)
Please I would like to know if it is possible to plot a transfer function that depends on the variable "s" but also the gain of the feedback.
I give you below the part of my program that is related to my question. (A,B,C,D and alpha are defined already).
H=tf(gain*[1 2*alpha alpha^2],[1 0]);
bode BF(1,1);
This program is perfectly working and I can plot the bode diagram of BF(1,1) for example directly.
What I want to do though, is to plot BF(1,1) for different values of the variable gain, let's say for gain varying from 1 to 100, and to have then a 3D representation of BF(1,1) according to the parameter "s" (the frequency) and the parameter gain in the feedback function.
I hope that my question is clear and I hope I find an answer for it.
Thank you,

Risposte (1)

Teja Muppirala
Teja Muppirala il 13 Set 2016
You can loop over different values of "gain" and collect the results in a matrix and then plot it as a surface.
alpha = 1;
gainList = 1:100;
w = logspace(-1,3,51);
magSurf = [];
for n = 1:numel(gainList)
gain = gainList(n);
H=tf(gain*[1 2*alpha alpha^2],[1 0]);
[mag,phase] = bode(BF(1,1),w);
magSurf(n,:) = mag(:);
xlabel('Frequency (rad/s)');
zlabel('Magnitude BF(1,1) dB')

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by