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

1 ビュー (過去 30 日間)
salma el asmai 2016 年 9 月 12 日

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,

サインインしてコメントする。

### 回答 (1 件)

Teja Muppirala 2016 年 9 月 13 日
You can loop over different values of "gain" and collect the results in a matrix and then plot it as a surface.
rng(0)
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')
ylabel('gain')
zlabel('Magnitude BF(1,1) dB')

サインインしてコメントする。

### カテゴリ

Find more on Frequency-Domain Analysis in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by