Phase portrait for Complex ODE
显示 更早的评论
Hi, I am trying to use:
if true
% code
end
function pdecaller()
options = odeset('OutputFcn',@odephas2);
for i=-4:4
for j= -4:4
[t,y] = ode45(@vdp1,[0 20],[i;j],options); hold on;
end
end
end
%c
function dydt = vdp1(t,y)
dydt=[ -i*(5.34E-12.*2.*2.033E-22)/((3.66E-5)^2).*y(1)-5.79E-68; y(2)];;
end
to plot a complex phase portrait. It gives however the result:
>> phaseportrait_caller Error using odephas2 (line 67) Error updating the ODEPHAS2 window. Solution data may have been corrupted. Argument X cannot be complex.
Error in ode45 (line 435) stop = feval(outputFcn,tout_new,yout_new(outputs,:),'',outputArgs{:});
Error in phaseportrait_caller (line 5) [t,y] = ode45(@vdp1,[0 20],[i;j],options); hold on;
Can anyone think of an alternative?
Thanks
2 个评论
Jan
2017-11-23
What is the purpose of "hold on" here? It seems like the error occurs in odepahs2, but you did not post the corresponding code.
Your initial values have the magnitude of 1. The formula for the 1st component is (constants calculated already):
1i * 1.6208635671414494e-33 * y(1) - 5.79e-68
and the 2nd component is fixed. Then the 2nd component is independent from the 1st one and you can omit the repeated integrations. Note that the term "5.79e-68" will matter for i=0 only, because it is too tiny and the limited precision will round it away.
I'm not sure if the step size control of ODE45 handles the two magnitudes differing by a factor of 1e32 as you expect it. Maybe it is smarter to scale the inputs to be in the same magnitude.
Sergio Manzetti
2017-11-23
编辑:Sergio Manzetti
2017-11-23
采纳的回答
更多回答(1 个)
Sergio Manzetti
2017-11-23
0 个投票
1 个评论
Birdman
2017-11-23
If the answer is useful, please accept it. And delete this answer. If you want to reply, write it under my answer.
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!