lsim with nonzero initial condition

22 views (last 30 days)
Mostafa M Naseri
Mostafa M Naseri on 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?

Answers (3)

Fangjun Jiang
Fangjun Jiang on 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 on 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 Comment
Fangjun Jiang
Fangjun Jiang on 3 Jan 2012
You are right about lsim(A, B, C, D, ...). See update in my answer.

Sign in to comment.


Walter Roberson
Walter Roberson on 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.

Categories

Find more on Robust Control Toolbox 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!