MATLAB How Do You Solve ODEs with Runge-Kutta in MATLAB?

  • Thread starter Thread starter lordtozo
  • Start date Start date
  • Tags Tags
    Matlab Ode
AI Thread Summary
The discussion centers on solving a differential equation using the Runge-Kutta method in MATLAB, specifically the ode45 function. A user expresses difficulty in obtaining consistent results, noting discrepancies in their answers. Suggestions include using Simulink to treat the variable as time and compute derivatives, with a recommendation to select a fixed step solver in the simulation parameters. The conversation highlights the effectiveness of Simulink for complex functions despite some users' aversion to it. Further assistance is sought for clarifying the integration process and addressing the output inconsistencies.
lordtozo
Messages
2
Reaction score
0
d(B^2W)/dx = BW

d(B^2W^2)/dx = (W(1-x)^1/n)^-1

more details are found in the attached file

I have a problem and need serious help using runge-kutta in MATLAB to solve ode

please find attached the problem.

I would appreciate it if someone helps me out

Thanks
 

Attachments

Last edited:
Physics news on Phys.org
Try ode45. In console, type
Code:
help ode45
 
Thanks AiRAVATA.

I have already tried that but I get half of my answers to be equal to the solution and the rest having a difference between +1 and +1.5.
 
I don't understand. Can you elaborate?
 
Use simulink and treat your X variable as time. Then you can use whatever complicated function you want to update. Compute the derivatives and integrate once. Then supply the result as the new X variable to the system.

I hate SIMULINK anyway. But very convenient for such things. Oh by the way, choose a fixed step solver in simulation parameters.
 
Back
Top