From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: control system
Date: Wed, 11 Sep 2013 18:31:08 -0500
Organization: NNTP Server
Lines: 55
Message-ID: <l0qufv$qav$>
References: <l0koal$ql6$> <l0mfv5$9g9$> <l0n9fi$bs7$> <l0nlbl$ps2$> <l0q1nf$amc$>
Reply-To: <HIDDEN>
NNTP-Posting-Host: Rww8NQxYv/
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
X-Notice: Filtered by postfilter v. 0.8.2
Xref: comp.soft-sys.matlab:802256

On 9/11/2013 10:20 AM, ROHIT MISHRA wrote:

>>>> ----------------------------
>>>> clear all
>>>> A = [0 1;2 3]; B = [0 ; 1]; x0 = [1;0];
>>>> sys = ss(A,B,[0 1],[]);
>>>> initial(sys,x0,16.4)
>>>> ----------------------

>> i hav solved the problem by solving the entire equation of x(t) which involves
>integral and non integral terms.since the length of the solution became
>huge so i was trying to find a shorter way...i hav seen the ode45
>command but didnt used it ...i will definitely try to solve the
>state equation using it...thanks 4 d help.......................ROHIT

I do not know what the difficulties you had. But the state
equation can be easily used for ode45.

 From above, just write the odes, they are

x1' = x2
x2' = 2*x1 + 3*x2 + 1*u(t)

You can even backtrack the second order ODE from the above, like

Let x2=y' and x1=y, then


     y''-3*y'-2*y = u(t)

This is a second order ODE. btw, one can see right away,
this is not stable ode. So, your model is wrong if this
is meant to be a real physical model. Stiffness term
can't be negative in real system.

You do not even need ode45 to solve this. You can solve
it by hand depending how complicated the forcing function
is. For siusodial, simply do (using syms, to get
exact analytical solution)

syms y(t) t
sol=dsolve(diff(y,2)-3*diff(y)-2*y==sin(t), y(0)==1, dy(0)==0)

This is your x1(t), which is y(t)