Using ODE45 for coupled equations

Hello,
For the given set of equations, which are coupled, how do I solve them using ODE45 function? I have gone through the documentation for ODE45 but I seem clueless when it comes to this case. Kindly help. I have values for dV/dtheta and dQ/dtheta stored already
Thanks!

6 件のコメント

James Tursa
James Tursa 2020 年 11 月 18 日
Looks like you have four variables: P, V, Q, and W. You're going to need four differential equations to solve this. What do you have for dV/dtheta and dQ/dtheta?
BipityBop
BipityBop 2020 年 11 月 18 日
I have values for dV/dtheta and dQ/dtheta stored already. Sorry, I forgot to mention that
James Tursa
James Tursa 2020 年 11 月 18 日
Constant values? Or equations?
BipityBop
BipityBop 2020 年 11 月 18 日
編集済み: BipityBop 2020 年 11 月 18 日
Constant values, for theta ranging from 0 to 360 degrees
James Tursa
James Tursa 2020 年 11 月 18 日
I don't understand. Do you have equations for dV/dtheta and dQ/dtheta? Why are you suddenly talking about constant values for theta?
BipityBop
BipityBop 2020 年 11 月 18 日
I have equations for dV/dtheta and dQ/dtheta.
They are as follows

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

 採用された回答

James Tursa
James Tursa 2020 年 11 月 18 日
編集済み: James Tursa 2020 年 11 月 18 日

0 投票

General procedure:
Define a variable, let's call it y to match the doc, that will be your state vector. Each element of y corresponds to one of your integration variables. E.g.,
y(1) = P
y(2) = Q
y(3) = V
y(4) = W
y(5) = xb
Then you write a derivative function that calculates the dy/dtheta vector. E.g.,
function dydtheta = myderiv(t,y,g,r,____) <-- fill in with everything that needs to be passed in
P = y(1);
Q = y(2);
V = y(3);
W = y(4);
Xb = y(5);
dPdtheta = -g * (P/V) * dVdtheta + (g-1)/V * dQdtheta;
dQdtheta = ___;
dVdtheta = ___;
dWdtheta = P * dVdtheta;
dXbdtheta = ___;
dydtheta = [dPdtheta;dQdtheta;dVdtheta;dWdtheta;dXbdtheta];
end
Fill in the blanks with your derivative code.
When you call ode45( ), use a function handle that has all the extra stuff you need to pass in. E.g.,
f = @(t,y) myderiv(t,y,g,r,____); <-- fill in the extra stuff that needs to be passed in

1 件のコメント

BipityBop
BipityBop 2020 年 11 月 18 日
Thanks a ton! Much appreciated

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

その他の回答 (0 件)

カテゴリ

製品

質問済み:

2020 年 11 月 18 日

コメント済み:

2020 年 11 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by