lsim with nonzero initial condition

22 Ansichten (letzte 30 Tage)
Mostafa M Naseri
Mostafa M Naseri am 3 Jan. 2012
i have a reactor with initial temprature=90 and i have a optimal temrature trajectory as a set point . i use lsim with initial condition like this :
X0 = [90 90 90 90 90 90]; [y]=lsim(A, B, C, D, u, t , X0) plot(t,y)
but the plot is start from y( in my example is temprature) =0 how can i set my initail temprature equal to 90 in t=0?

Antworten (3)

Fangjun Jiang
Fangjun Jiang am 3 Jan. 2012
You can't use lsim(A,B,C,D,...). You need to use
Sys=ss(A,B,C,D);
y=lsim(Sys,u,t,X0);
UPDATE: You can't arbitrarily set your initial y. Once you get it right, Y0 should be reflected by y=Cx+Du.
It looks like lsim(A,B,C,D,...) works too. I started dislike this feature, especially it was not mentioned in the document.
Sys=rss(2);
X0=[1 1];
u=rand(101,1);
t=0:0.01:1;
y=lsim(Sys,u,t,X0);
figure(1);plot(t,y);
y2=lsim(Sys.a,Sys.b,Sys.c,Sys.d,u,t,X0);
figure(2);plot(t,y2)

Mostafa M Naseri
Mostafa M Naseri am 3 Jan. 2012
thanx for your answer .both of them are true, you can write like something i wrote: [y]=lsim(A, B, C, D, u, t , X0) but it doesnt solve my problem , I asked about initial condition
  1 Kommentar
Fangjun Jiang
Fangjun Jiang am 3 Jan. 2012
You are right about lsim(A, B, C, D, ...). See update in my answer.

Melden Sie sich an, um zu kommentieren.


Walter Roberson
Walter Roberson am 3 Jan. 2012
Mostafa, where do you see documented any ability to write lsim(A, B, C, D, u, t, X0) ? The lsim documentation appears to show that the first argument to lsim must be an LTI model.
To change the plot so that it does not start at y = 0, you could (somehow) determine the figure number of the plot, findobj() the axis for it, get() the axis YLim property, replace the lower bound of the ylim with 90, and set() that as the new axis YLim property.

Kategorien

Mehr zu Robust Control Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by