helppp meeee!!!!!!! lsim
Show older comments
hi, I dont this problem with lsim, help me
di1/dt = -15000*i1 -10000*i2 +4000*i3 +5000*t^2+ 10000
di2/dt = -7000*i2 -3333,33*i1 -2666,66*i3+666,66*exp(t)+1666,66
di3/dt= -8500*i3 -4000*i2+ 2000*i1+25000
x0=[5.6,-4.82,6.51]
t=0:0.01:5;
my codes;
a=[-15000 -10000 4000; -3333.33 -7000 -2666.66; 2000 -4000 -8500];
b=[1 0 0;0 1 0;0 0 1];
c=[1 0 0;0 1 0;0 0 1];
d=[0 0 0;0 0 0;0 0 0];
x0=[5.6 -4.82 6.51];
t=0:0.01:5;
u=[(5000*(t.^2))+10000;(666.66*exp(t))+1666.66;25000];
[y x]=lsim(a,b,c,d,u,t,x0)
subplot(211),plot(t,x(:,1)),xlabel('t'),ylabel('vc')
grid,subplot(212),plot(t,x(:,2)),xlabel('t'),ylabel('il'),grid
ı think cause of error is matrix sizes are not equal or y function is not true
1 Comment
Walter Roberson
on 3 May 2020
t=0:0.01:5;
t is a vector
u=[(5000*(t.^2))+10000;(666.66*exp(t))+1666.66;25000];
The first row involves t so it is a vector the same length as t.
The second row involves t and is the same length as the first, which is good.. The third row is 25000 which is a scalar not the same length as t. You need to make copies of the 25000
You are creating 3 rows but u would want 3 columns.
Answers (0)
Categories
Find more on Mathematics 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!