Solving an ODE with restriction on states
2 views (last 30 days)
Show older comments
Hi I have a set of equations and I am solving them with ode45. everything is working fine and the results are as expected. Now I want to apply a restriction to one of the states and I don't know how should I do that. the system has 10 states and the restriction is as follows:
I want to apply the restriction to my second state, I want it to be equal to first state when it's less than the first state and be itself when it's greater. something like this:
if x(2) < x(1) x(2) = x(1) end
Does anybody know how I should apply this to my code? should I write an event for the ode45?
Thanks
1 Comment
Antonio Garcia-Martinez
on 28 Mar 2016
There are two ways ...with "odeset" in Events section or using "Parameterizing Functions" ...you should check this two topics
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations 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!