Do the ODE functions from MATLAB (i.e. ODE23, ODE24) handle complex numbers properly?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
For example, I want to integrate the equation dy/dt = sqrt(t) + y for 't' from -10 to 10 and for initial 'y' values of 1 and 2.
To do this, I would use:
]
[t,y] = ode45(@(t,y) sqrt(t)+y,-10:10,[1 2]);
Akzeptierte Antwort
MathWorks Support Team
am 26 Jul. 2010
The ODE solvers in MATLAB 5 (R12) and later releases properly handle complex valued systems.
When writing code, keep in mind the following:
The ' operator implements produces the conjugate transpose, while the .' operator performs a non-conjugate transpose. Improperly using one when you want the other will result in unexpected solutions.
For example:
M = rand(2)+rand(2)*i
M =
0.4451 + 0.8462i 0.4660 + 0.2026i
0.9318 + 0.5252i 0.4186 + 0.6721i
M.'
ans =
0.4451 + 0.8462i 0.9318 + 0.5252i
0.4660 + 0.2026i 0.4186 + 0.6721i
M'
ans =
0.4451 - 0.8462i 0.9318 - 0.5252i
0.4660 - 0.2026i 0.4186 - 0.6721i
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!