Solving an ODE for a Complex Variable in Polar Coordinates
古いコメントを表示
I want to solve an ODE where the variable of interest is a complex number in terms of polar coordinates,
. I have been using the example here where they have chosen
. I roughly know what the dynamics of the system should look like (it is a well-known reduction of the Kuramoto model) and am almost certain that it should not have features that cause ode45() to have any problems. However, the systems seems to blow up. I believe it is because of how I have set up definitions or returned values in the Second Function File, but I am not sure. Does anyone have any suggestions? Thanks!
Second Function File and Call:
% Set up ICs and t, then solve
zv0 = [0.8; 3];
tspan = [0 100];
[t, zv] = ode45(@imaginaryODE, tspan, zv0);
% Plot
plot(t,zv(:,1))
function fv = imaginaryODE(t, zv)
% Construct z from argument and angle
z = abs(zv(1)).*exp(1i.*angle(zv(2)));
% Evaluate for the function defined in complexf.m
zp = complexf(t, z);
% Return argument and angle
fv = [abs(zp); angle(zp)];
end
First Function File:
function f = complexf(t, z)
% Constants
omega0 = 2.*pi/24;
gamma = 1/100;
k = 1;
% Function
f = (1i.*omega0 - gamma).*z + (k/2).*(z - (z^2).*conj(z));
end
3 件のコメント
darova
2020 年 3 月 18 日
Please attach original eqautions
Cameron3332
2020 年 3 月 18 日
darova
2020 年 3 月 18 日
You code looks OK. I changed this
tspan = [0 2.45];
result

採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


