ODE for Solving Switched State Space Equations |
|
Hello,
I have a system: Xdot = A*X + B*u; A variable 'sw' decides whether to use A1 or A0 for A. Likewise B1 or B0;
The initial conditions of X are:[0 0 0 0]' and sw = 0.
I have to solve the ode for 1 milisecond with a time step of 1e-9.
Since X is all zeros and sw = 0, i begin with Xdot = A0*X + B0*u.
After each iteration, X and sw have to be checked. Based on a particular value of any of the components of X and the value of sw in the previous iteration, the sw for the next iteration is set to sw=1 and the ode Xdot = A1*X + B0*u is to be solved.
I wanted to use ode23tb ( since the system is stiff).
How do i proceed?
Thanks.
|
Re: ODE for Solving Switched State Space Equations |
|
"Hadhiq Khan" wrote in message ...
> Hello,
> I have a system: Xdot = A*X + B*u; A variable 'sw' decides whether to use A1 or A0 for A. Likewise B1 or B0;
> The initial conditions of X are:[0 0 0 0]' and sw = 0.
> I have to solve the ode for 1 milisecond with a time step of 1e-9.
> Since X is all zeros and sw = 0, i begin with Xdot = A0*X + B0*u.
> After each iteration, X and sw have to be checked. Based on a particular value of any of the components of X and the value of sw in the previous iteration, the sw for the next iteration is set to sw=1 and the ode Xdot = A1*X + B0*u is to be solved.
>
> I wanted to use ode23tb ( since the system is stiff).
>
> How do i proceed?
>
>
> Thanks.
Look at the "Events" facility in the options structure.
Best wishes
Torsten.
|