Do the ODE functions from MATLAB (i.e. ODE23, ODE24) handle complex numbers properly?

5 次查看(过去 30 天)
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]);

采纳的回答

MathWorks Support Team
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 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by