how to solve Coupled equations including ODE and algebraic equations?

All my variables are interdependent. How do I pass extra variables for Ode and algebraic equations?

 採用された回答

Richard Crozier
Richard Crozier 2012 年 10 月 4 日

0 投票

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.

4 件のコメント

Urvi
Urvi 2012 年 10 月 5 日
Thanks! I have an equation for EVI but all my equations are inter related hence I dont understand how to incorporate that into my code.
Richard Crozier
Richard Crozier 2012 年 10 月 8 日
編集済み: Richard Crozier 2012 年 10 月 8 日
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.
Richard Crozier
Richard Crozier 2012 年 10 月 8 日
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.
Urvi
Urvi 2012 年 10 月 9 日
ya sure. Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by