Confusion, matlab, ode45 variables.

Click For Summary
SUMMARY

The discussion centers on the use of MATLAB's ode45 function for solving ordinary differential equations (ODEs) and the confusion regarding variable changeability. The user has defined constants a, k, and w, while attempting to determine the derivatives adot and adoubledot based on a changing variable p. It is established that ode45 requires a function definition where only one variable can change over time, necessitating the use of a column vector for multiple variables.

PREREQUISITES
  • Understanding of MATLAB syntax and functions
  • Familiarity with ordinary differential equations (ODEs)
  • Knowledge of MATLAB's ode45 function and its requirements
  • Basic concepts of variable definitions and scope in programming
NEXT STEPS
  • Explore MATLAB's documentation on the ode45 function for detailed usage
  • Learn how to define functions in MATLAB for ODEs
  • Investigate the use of column vectors in MATLAB for multiple variables
  • Study examples of variable changeability in MATLAB ODEs
USEFUL FOR

Students and professionals working with MATLAB for solving ordinary differential equations, particularly those seeking to understand variable management in dynamic systems.

Smiles302
Messages
26
Reaction score
0

Homework Statement



I am very confused over how MATLAB knows which variables are changeable variables in ode45.


Homework Equations

//

The Attempt at a Solution



My input is p

Earlier have defined;
a = 1;
k = 1;
w = 1/3;

Then I want to figure out adot and adoubledot from these.

adot = (a)*(p - k/a)^(-1/2);

adoubledot = (a/2)*(p + 3*w*p);

Suddenly realized that I have no idea why MATLAB would let "a" change but not let "p" and "k" change...

Is there a way to tell MATLAB that one of the variables is changing in time and the others aren't?
 
Physics news on Phys.org
Nobody? =( Does my question make sense?
 
I'm not sure exactly what you're asking. For ode45 you need to define a function. Ode45 uses the function definition for variables. (I think you need to have only one variable For ode45, so if you have more than one you can use a column vector.)
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
896
  • · Replies 1 ·
Replies
1
Views
2K
Replies
5
Views
6K
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K