MATLAB Answers


how to solve Coupled equations including ODE and algebraic equations?

Asked by Urvi
on 4 Oct 2012
All my variables are interdependent. How do I pass extra variables for Ode and algebraic equations?


Sign in to comment.


1 Answer

Answer by Richard Crozier on 4 Oct 2012
 Accepted Answer

Well, the error says it all, you don't define EVI in the function trial.m, it's not passed in as a variable anywhere, and its not declared as a global. Therefore you get an error EVI not defined. Same for VI.
See the docs on ode45 etc. for the standard method of how to pass in extra variables to the ode solvers.


Show 1 older comment
When you call ode45 you can do things with anonymous functions like:
EVI = 0;
VI = i490324023;
sol = ode45(@(t,y) myfun(t,y,EVI,VI), tspan, initconds);
Look up anonymous functions for more info.
By the way, you should have left the question as it was, now others looking up the same question won't understand the answer. Start a new question for a new (better defined) problem.

Sign in to comment.