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
2010-7-26
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!