Check ode15s code to solve a double derivative DE

2 ビュー (過去 30 日間)
James Ly
James Ly 2020 年 8 月 10 日
回答済み: Ayush Gupta 2020 年 9 月 3 日
I'm pretty much a complete beginner and I've tried modifying an existing code to solve the Gilmore equation. I've attached the code in a txt file as well as a picture of the equations I'm trying to model.
Please let me know if I have to change anything.
  1 件のコメント
Deepak Gupta
Deepak Gupta 2020 年 8 月 10 日
From line number 47:
H_0 = ; % Initial enthalpy
H_1 = ; % Final enthalpy (?)
These values are not defined. There is syntax error in line 103 also.
dydt = R*y(3)*(1/y(2)/c)+1.5*y(2)^2*(1-y(2)/(3*c)-H*z(2)*(1+y(2)/c) ;

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

回答 (1 件)

Ayush Gupta
Ayush Gupta 2020 年 9 月 3 日
There a couple of problems in the code, I would recommend breaking the function into two functions for ease of understanding. On line 47 there are no values initialized for H_0 and H_1. Also it gives a syntax error in
dydt = [y(3); R*y(3)*(1/y(2)/c)+1.5*y(2)^2*(1-y(2)/(3*c))-H*z(2)*(1+y(2)/c)];
The z variable which is used here is undefined or not initialized. To have a function call to get the equation inside the ode15s function check the documentation of ode15s and examples on how to use it here.

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by