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

  • Context: MATLAB 
  • Thread starter Thread starter lordtozo
  • Start date Start date
  • Tags Tags
    Matlab Ode
Click For Summary

Discussion Overview

The discussion revolves around solving ordinary differential equations (ODEs) using the Runge-Kutta method in MATLAB, specifically addressing issues faced by a participant in obtaining accurate solutions. The scope includes technical explanations and potential applications of MATLAB functions for ODE solving.

Discussion Character

  • Technical explanation, Debate/contested, Experimental/applied

Main Points Raised

  • One participant presents a set of ODEs and requests assistance with using the Runge-Kutta method in MATLAB.
  • Another participant suggests using the MATLAB function ode45 for solving the ODEs.
  • A participant expresses that they have tried ode45 but encountered discrepancies in their results, with some answers being close to the expected solution while others differ significantly.
  • One participant requests clarification on the issues faced by the previous contributor.
  • Another participant proposes using Simulink to treat the variable as time and suggests computing derivatives and integrating, while expressing a dislike for Simulink.
  • The suggestion includes using a fixed step solver in the simulation parameters for better results.

Areas of Agreement / Disagreement

The discussion reflects a lack of consensus on the best approach to solve the ODEs, with multiple suggestions and experiences shared, indicating that participants have differing views on the effectiveness of the proposed methods.

Contextual Notes

Participants have not fully resolved the discrepancies in the results obtained from ode45, and there are assumptions about the nature of the ODEs and the specific conditions under which the methods are applied.

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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 65 ·
3
Replies
65
Views
9K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K