|
|
While loop for ode45 solver
I have written a program that simulates the trajectory of a probe entering earth's atmosphere. This trajectory is modeled by 6 differential equations. I am using ode45 to solve these equations.
I would the solver to calculate a solution until the probe hits the ground, but the point at which it hits the ground is only know after the solution is displayed. I would like to create some sort of while loop that goes like this:
while altitude >= 0
solve set of equations
end
display solution
The problem is that the time at which the probe hits the ground is only known after the code has ran, so there is no way to know that at 1775 seconds into the simulation, the probe hits the ground. However, a time vector (independent variable) must first be defined before the system can be solved. I don't mind having an excess time vector and then for display purposes (equal size vectors) have the time vector chopped to the same size as the solution vector. The solution is working perfectly fine, but it takes so long for each step that any excess results would save time and eliminate bogus subterranean results. Anyone have any ideas on how this feat could be accomplsihed? Thanks.
|
|
0
|
|
|
|
Reply
|
Stephen
|
3/2/2010 2:10:09 AM |
|
Dear Stephen!
> I have written a program that simulates the trajectory of a probe entering earth's atmosphere. This trajectory is modeled by 6 differential equations. I am using ode45 to solve these equations.
>
> I would the solver to calculate a solution until the probe hits the ground, but the point at which it hits the ground is only know after the solution is displayed.
Use the 'Events' property in OPTIONS, as suggested by:
help ode45
Good luck, Jan
|
|
0
|
|
|
|
Reply
|
Jan
|
3/2/2010 10:46:05 AM
|
|
"Stephen " <hphilli5@utk.edu> wrote in message
news:hmhs21$a98$1@fred.mathworks.com...
>I have written a program that simulates the trajectory of a probe entering
>earth's atmosphere. This trajectory is modeled by 6 differential equations.
>I am using ode45 to solve these equations.
> I would the solver to calculate a solution until the probe hits the
> ground, but the point at which it hits the ground is only know after the
> solution is displayed. I would like to create some sort of while loop that
> goes like this:
> while altitude >= 0
> solve set of equations
> end
> display solution
>
> The problem is that the time at which the probe hits the ground is only
> known after the code has ran, so there is no way to know that at 1775
> seconds into the simulation, the probe hits the ground. However, a time
> vector (independent variable) must first be defined before the system can
> be solved. I don't mind having an excess time vector and then for display
> purposes (equal size vectors) have the time vector chopped to the same
> size as the solution vector. The solution is working perfectly fine, but
> it takes so long for each step that any excess results would save time and
> eliminate bogus subterranean results. Anyone have any ideas on how this
> feat could be accomplsihed? Thanks.
Look at the BALLODE demo for an example that uses an Events function to
answer exactly that question.
--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
|
0
|
|
|
|
Reply
|
Steven
|
3/2/2010 2:49:51 PM
|
|
|
2 Replies
429 Views
(page loaded in 1.099 seconds)
Similiar Articles: While loop for ode45 solver - comp.soft-sys.matlabI have written a program that simulates the trajectory of a probe entering earth's atmosphere. This trajectory is modeled by 6 differential equations.... getting error during solving nonlinear differential equation by ...while solving some nonlinear differential equation in matlab by using ode45 solver i got following warning Warning: Failure ... Help solving ODEs in a loop - comp.soft-sys ... ode23 - comp.soft-sys.matlabWhile loop for ode45 solver - comp.soft-sys.matlab ode23, ode45, ode113, ode15s, ode23s, ode23t, ode23tb - Solve ... Loop Control - for, while, continue, break Program ... Help solving ODEs in a loop - comp.soft-sys.matlabWhile loop for ode45 solver - comp.soft-sys.matlab Solving Ordinary differential equations by NDSolve - comp.soft-sys ... Help solving ODEs in a loop - comp.soft-sys ... While loops - comp.soft-sys.matlabWhile loop for ode45 solver - comp.soft-sys.matlab I have written a program that simulates the trajectory of a probe entering earth's atmosphere. solving 2nd order differential equations by ode45 - comp.soft-sys ...While loop for ode45 solver - comp.soft-sys.matlab This trajectory is modeled by 6 differential equations. I am using ode45 to solve these equations. ... soft-sys.matlab ... algebraic loop - comp.soft-sys.matlabWhile loop for ode45 solver - comp.soft-sys.matlab I would like to create some sort of while loop that goes like this: while ... solver - comp.soft-sys.matlab lsqcurvefit ... Solving an ODE using RungeKutta methods. - comp.soft-sys.matlab ...While loop for ode45 solver - comp.soft-sys.matlab Solving an ODE using RungeKutta methods. - comp.soft-sys.matlab ... time step in ode45 - comp.soft-sys.matlab... events ... Changing Inputs per Time Step in ODE45 - comp.soft-sys.matlab ...... new MATLAB user and I am attempting to use the ODE45 solver ... I have attempted to do this by using a For loop and ... bin (binary) file - comp.soft-sys.matlab ..... while ... Help with the lsqcurvefit solver - comp.soft-sys.matlab> While I do not understand exactly what ansys ... Problem with "Trouble solving algebraic loop ... Help with the lsqcurvefit solver - comp.soft-sys.matlab Using ode45 with a second ... While loop for ode45 solver - comp.soft-sys.matlab | Computer GroupI have written a program that simulates the trajectory of a probe entering earth's atmosphere. This trajectory is modeled by 6 differential equations.... ode23, ode45, ode113, ode15s, ode23s, ode23t, ode23tb - Solve ...Loop Control - for, while, continue, break Program Termination - return ... Like ode113, ode15s is a multistep solver. Try ode15s when ode45 fails, or is very ... 7/22/2012 8:32:23 AM
|
|
|
|
|
|
|
|
|