Could anyone tell me what it means in the code(xfer1(i) = xfer(5,1))?

3 Ansichten (letzte 30 Tage)
Byungho
Byungho am 27 Mär. 2024
Bearbeitet: Aquatris am 27 Mär. 2024
a11=-400;
a12=0.077;
a13=2200*(-1.3*10^-5)/(1.6*10^-5);
a14=2200*(-2*10^-4)/(2*1.6*10^-5);
a31=0.975*10^6/(12537.5*1055.1);
a33=-1/6.04;
a41=0.025*10^6/(31355.1*1055.1);
a43=1/15.1;
a44=-1/15.1-2/0.84;
a54=-1/15.1+2/0.84;
a55=-2/0.84;
b1=2200/(1.6*10^-5);
b4=2/0.84;
A=[a11,a12,a13,a14,a14;-a11,-a12,0,0,0;a31,0,a33,-a33,0;a41,0,a43,a44,0;a41,0,a43,a54,a55];
b=[0;0;0;b4;0];
w=logspace(-3,4,10000)
w = 1x10000
0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010
for i=1:length(w)
AB = [j*w(i)-a11 -a12 -a13 -a14 -a14; a11 j*w(i)+a12 0 0 0; -a31 0 j*w(i)-a33 a33 0; -a41 0 -a43 j*w(i)-a44 0;-a41 0 -a43 -a54 j*w(i)-a55];
xfer = inv(AB)*b;
xfer1(i) = xfer(5,1);
end
loglog(w,abs(xfer1));
title('\fontsize{16}Coolant Temperature Transfer Function-\delta\theta_{2}(\omega)/\delta\theta_{in}(\omega)')
ylabel('\fontsize{13}Gain')
xlabel('\fontsize{13}Frequency (rad/sec)')
This code calculates inv[SI-A]*b, the transfer function's gain.
Could you please explain what the code (xfer1(i) = xfer(5,1)) means?
Does this mean that the code computes the transfer function for the fifth row?
  1 Kommentar
Mathieu NOE
Mathieu NOE am 27 Mär. 2024
seems to me (according to size(A)) you have a 5 input , 5 output model
with b you select the 4th input
then you plot the 5th output (and that is xfer1)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Aquatris
Aquatris am 27 Mär. 2024
Bearbeitet: Aquatris am 27 Mär. 2024
So from the context, it seems like 'xfer' is the complex value of your transfer function at a particular 'w', it is a 5x5 matrix. Then, since you are only interested in the effects of 1st input on the 5th state, you only store the 'xfer(5,1)'. Keep in mind, rows corresponds to states/outputs, columns correspond to inputs.
So to answer your question, the code calculates the TF for all input and outputs, but only stores the one from 1st input to 5th output with '(xfer1(i) = xfer(5,1)) '.
% so your system transfer function TF is
TF = [xfer(1,1) xfer(1,2) xfer(1,3) xfer(1,4) xfer(1,5);
xfer(2,1) xfer(2,2) xfer(2,3) xfer(2,4) xfer(2,5);
xfer(3,1) xfer(3,2) xfer(3,3) xfer(3,4) xfer(3,5);
xfer(4,1) xfer(4,2) xfer(4,3) xfer(4,4) xfer(4,5);
xfer(5,1) xfer(5,2) xfer(5,3) xfer(5,4) xfer(5,5)];

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by