I am trying to plot an input function u(t) along a time interval [0,1] but I keep getting errors when i try to plot. Can anyone help me fix the code so it can plot?

syms s t
A= [0,1,1,0;0,0,-2,1;0,0,0,1;0,0,3,-2];
B= [0;1;2;1];
C= [1,1,0,0];
x0= [0;2;0;1];
SI= [s,0,0,0;0,s,0,0;0,0,s,0;0,0,0,s];
e= SI-A;
F= inv(e);
k= ilaplace(F);
IT= transpose(k);
BT= transpose(B);
x= k*B*BT*IT;
W= int(x, 0, t)
WI= inv(W)
u= (-BT)*IT*WI*x0
t= 0:0.1:1;
plot(t,u)

 Accepted Answer

Hello Royson,
Looks like some sort of control problem involving the controllability Gramian? Maybe this is what you're looking for?
syms s t
A= [0,1,1,0;0,0,-2,1;0,0,0,1;0,0,3,-2];
B= [0;1;2;1];
C= [1,1,0,0];
x0= [0;2;0;1];
SI= [s,0,0,0;0,s,0,0;0,0,s,0;0,0,0,s];
e= SI-A;
F= inv(e);
k= ilaplace(F);
IT= transpose(k);
BT= transpose(B);
x= k*B*BT*IT;
W= int(x, 0, t);
WI= inv(W);
u = (-BT)*IT*WI*x0;
u = simplify(u,100)
u = 
% exp(t) - 1 in the denominator, can't evaluate at t = 0
tval = .1:.1:1;
plot(tval,subs(u,t,tval))

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!