obtaining a point solution of a differential equation

i have DE in following form and I am using ode45 to solve for it
[t,y] = ode45(@(t,y) f(t,y), tspan, y(i))
where y(i) is the initial value for current tspan. the problem i am onto has a time dependent f(t,y) i.e., the expression associated with f(t,y) changes at a certain time interval.
for eg: f(t,y)=g(t,y) for [0,t1]
f(t,y)=h(t,y) for [t1,t2] and so on.
so I need to evaluate DE at certain points of time to find out the initial value reqd to solve next DE having different f(x,y) and plot a continuous t vs y curve. I tried deval but for that i need redefine a DE everytime as sol1, sol2 and so on for finding out the required initial value. Is there any way to find out the point solution of DE without any more substituion?

Answers (0)

Asked:

on 25 Feb 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!