Reputation: 858
I am using ode45 and I can't figure out what to do in this case. I have a differential equation where my paramters change very quickly with time. Ideally, I would like to choose tspan to be like 0:epsilon:10*epsilon where epsilon is of an appropriately small order considering whatever I have in the factors of my DE. However, this does not work and MATLAB simply gives me a plot where nothing changes from my initial conditions.
I did the obvious thing to fix it which was the following. Say I have xdot(t)=10^9*x(t). I rewrite it as xdot(t)=x(t) and label my time axis as nanoseconds instead of seconds.
Just curious if MATLAB can do this on its own.
Upvotes: 1
Views: 401
Reputation: 12345
You can set a maximum time step using ODE options.
opt = odeset('MaxStep',epsilon)
[t,y] = ode45(odeFun,tSpan,y0,opt)
To get an idea of all the options that you can change when customizing an ODE solver look at docsearch odeset
.
Upvotes: 1