Surf respresentation of a transfer function depending on the frequency and the gain of the feedback
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
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).
sys=ss(A,B,C,D);
gain=1;
H=tf(gain*[1 2*alpha alpha^2],[1 0]);
BF=feedback(sys,H,2,2);
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,
0 commentaires
Réponses (1)
Teja Muppirala
le 13 Sep 2016
You can loop over different values of "gain" and collect the results in a matrix and then plot it as a surface.
rng(0)
sys=rss(3,2,2);
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]);
BF=feedback(sys,H,2,2);
[mag,phase] = bode(BF(1,1),w);
magSurf(n,:) = mag(:);
end
surf(w,gainList,20*log10(magSurf));
set(gca,'Xscale','log')
xlabel('Frequency (rad/s)');
ylabel('gain')
zlabel('Magnitude BF(1,1) dB')
0 commentaires
Voir également
Catégories
En savoir plus sur Get Started with Control System Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!