How to extract the first Transfer function.

2 visualizzazioni (ultimi 30 giorni)
Jorje German
Jorje German il 10 Set 2020
Risposto: Divija Aleti il 25 Set 2020
I have these 3 equations
X1(s)*[m1*s^2 + c1*s+(k01+k12)] = F(s) + k12*X2(s)
X2(s)*[m2*s^2 + c2*s +(k12+k23)] = k12*X1(s)+k23*X3(s)
X3(s) [m3*s^2 + c3*s +(k23+k34)] = k23*X2(s)
and I want to extract the first trasnfer function. So I can input it in this line of code "sys = (insert TF here)"
I dont really know how I would go about doing this.
m1=1;
m2=1;
m3=1;
c1=1;
c2=1;
c3=1;
k01=0;
k12=100;
k23=10;
k34=0;
t = 0:0.01:10;
U1 = 10+2*t;
U2 = sin(t);
s = tf('s');
p1=(m1*s^2 + c1*s +(k01+k12));
p2=(m2*s^2 + c2*s +(k12+k23));
p3=(m3*s^2 + c3*s +(k23+k34));
M = [p1 -k12 0; k12 -p2 k23; 0 k23 -p3];
M^-1
sys = ??? ; % I would be inputting my first transfer function there X1(s)/F(s)
%so I can then modify and plot it by the lines I have below.
%I can see that my TF is TF1 = (s^4 - 2*s^3 + 121*s^2 - 120*s + 1000)/(s^6 - 3*s^5 + 223*s^4 - 441*s^3 + 3220*s^2 -3000*s - 3.659e-12)
%I just dont know how to extract that from M^1 in order to put
%it in sys = (In here)
OPT = stepDataOptions('StepAmplitude', 100); % OPT means option to put in a step
[Y1, t1]=impulse(sys, 10);
[Y2, t2]=step(sys,10,OPT);
[Y3, t3]=lsim(sys,U1,t);
[Y4, t4]=lsim(sys,U2,t);
subplot(2,2,1)
plot(t1,Y1,'r')
hold on
title ('Impulse Response')
xlabel ('Time (S)')
ylabel("Amplitude)")
grid on
subplot(2,2,2)
plot(t2,Y2,'r')
hold on
title ('Step Response')
xlabel ('Time (S)')
ylabel("Amplitude)")
grid on
subplot(2,2,3)
plot(t3,Y3,'r')
hold on
title ('Step Ramp Response')
xlabel ('Time (S)')
ylabel("Amplitude)")
grid on
subplot(2,2,4)
plot(t4,Y4,'r')
hold on
title ('Sin Response')
xlabel ('Time (S)')
ylabel("Amplitude)")
grid on

Risposte (1)

Divija Aleti
Divija Aleti il 25 Set 2020
A possible way of solving this issue would be to solve the system of simultaneous equations and then use the 'tf' function to create the transfer function model.
Have a look at the following code:
m1=1;
m2=1;
m3=1;
c1=1;
c2=1;
c3=1;
k01=0;
k12=100;
k23=10;
k34=0;
syms X1 X2 X3 s F
eqns = [X1*(m1*s^2 + c1*s+(k01+k12)) == F + k12*X2, X2*(m2*s^2 + c2*s +(k12+k23)) == k12*X1+k23*X3, X3*(m3*s^2 + c3*s +(k23+k34)) == k23*X2];
S = solve(eqns,[X1,X2,X3]);
S.X1
Output:
Now, use the 'tf' function as follows:
numerator = [1,2,121,120,1000];
denominator = [1,3,223,441,3220,3000,0];
sys = tf(numerator,denominator);
The value of 'sys' would be:
For additional information on the functions 'solve' and 'tf', take a look at the following links :

Categorie

Scopri di più su Dynamic System Models in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by