Check ode15s code to solve a double derivative DE

2 visualizzazioni (ultimi 30 giorni)
James Ly
James Ly il 10 Ago 2020
Risposto: Ayush Gupta il 3 Set 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 Commento
Deepak Gupta
Deepak Gupta il 10 Ago 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) ;

Accedi per commentare.

Risposte (1)

Ayush Gupta
Ayush Gupta il 3 Set 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.

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by