Efficiently Solve Matrix of ODE's in MATLAB without Rewriting as Column Vectors

  • Context: MATLAB 
  • Thread starter Thread starter juef
  • Start date Start date
  • Tags Tags
    Matlab Matrix
Click For Summary
SUMMARY

The discussion focuses on solving a system of ordinary differential equations (ODEs) represented as X' = f(X) in MATLAB, where X is a square matrix. Users express concern that MATLAB's solvers require X to be a column vector, which could lead to inefficiencies if rewritten. A solution is provided using the MATLAB reshape command, allowing users to efficiently handle matrix forms without the need for conversion to column vectors. This method significantly simplifies the process and enhances performance.

PREREQUISITES
  • Understanding of ordinary differential equations (ODEs)
  • Familiarity with MATLAB programming environment
  • Knowledge of matrix operations in MATLAB
  • Experience with MATLAB's reshape function
NEXT STEPS
  • Explore MATLAB's ODE solvers, specifically ode45 and ode15s
  • Learn advanced matrix manipulation techniques in MATLAB
  • Investigate performance optimization strategies for MATLAB code
  • Study the implications of using vectorization in MATLAB for numerical computations
USEFUL FOR

Mathematicians, engineers, and researchers working with systems of ODEs in MATLAB, particularly those seeking efficient computational methods without extensive code rewriting.

juef
Messages
27
Reaction score
0
Hey all,

Consider the system [tex]X' = f(X)[/tex], where [tex]X[/tex] is a square matrix. I would like to solve this system with MATLAB, but all of its solvers require [tex]X[/tex] to be a column vector.

Of course, it would be possible to rewrite [tex]X'[/tex] and [tex]f(X)[/tex] as column vectors, but I guess some efficiency would be lost. It would also be a lot of pain to do

So, does anyone know of a simpler way to do such a thing? Thank you!
 
Physics news on Phys.org
It's not a pain to do with the reshape command.
 
:shy: Why on Earth didn't I think of that? You can't possibly imagine how much that just helped me! Thank you very much!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
9K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
11K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
15K