Check ode15s code to solve a double derivative DE

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by