ODE solver-using initial conditions in events function
显示 更早的评论
I want to solve a second-order ODE (time derivatives on x) using numerical solver like ode45:
mx''+cx'+kx+F1=0
where F1 is a nonlinear function of x and it's initial value x(0). But when x becomes x(0)-5, I want F1 to stop functioning and switch the ODE to
mx''+cx'+kx+F2=0
where F2 is just a constant and I will simulate it until x' is zero.
I know how to set event functions to make the integration stop at x'=0, but how can I switch between F1 and F2? Event functions seem not to support using initial conditions in the event describing.
One background is that F1 and F2 can be merged. When x becomes x(0)-5 and further, F1 will be a complex number while it's real part is just F2, so I can solve one equation
mx''+cx'+kx+real(F1)=0
until x' is zero. But then the simulation will not give a fine resolution at the switching point of F1 and F2. So if anyone can suggest a way to make fine resolution near the switching point of F1 and F2, that also solves my issue. Thank you!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
