Check ode15s code to solve a double derivative DE

2 visualizaciones (últimos 30 días)
James Ly
James Ly el 10 de Ag. de 2020
Respondida: Ayush Gupta el 3 de Sept. de 2020
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 comentario
Deepak Gupta
Deepak Gupta el 10 de Ag. de 2020
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) ;

Iniciar sesión para comentar.

Respuestas (1)

Ayush Gupta
Ayush Gupta el 3 de Sept. de 2020
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.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by