# Can I solve ode without explicit expression for derivative?

1 view (last 30 days)
Richard Crozier on 15 May 2016
Commented: Tejas on 18 May 2016
I would like to solve an ODE using Matlab's solvers, but where I don't have an explicit expression for the derivative. Specifically I want to simulate an electric motor. Normally this would be done with an equation like:
dI/dt = (E(t) - I(t)R) / L
Now I currently have an analytical expression for E(t), but really E(t) is the derivative of another underlying function, the flux Linkage, which I'll call phi. Then we have
E = -d phi(t) / dt
dI/dt = (E(t) - I(t)R) / L
Where R and L are constants.
My issue is that I would like to get the next value of the function phi from a finite element simulation at each time step, so I don't have an analytical expression for phi, or d phi(t) / dt.
Can I still use Matlab's ODE solvers to solve my problem, and if so, how?
Note that the problem usually requires a stiff solver like ode15s.
Tejas on 18 May 2016
Hello Richard,
This may be possible.
You may have to write a wrapper, let's call it, "getE(t)", around your Finite Element Simulator's results to return E(t) at a given t. This means that you will have to precompute the values of phi(t), and write this wrapper function that returns the time gradient of phi(t) at any given value of "t". You might have to do some interpolation in order to get a value for phi (and hence E) at any given value of "t"
You can then use this "getE(t)" in your " odefun" handle to setup the ODE equation as:
function dIdt = odefun(t,I)
dIdt = (getE(t) - I(t)*R)/L
end

### Categories

Find more on Programming 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!