Phase portrait for Complex ODE
Show older comments
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 Comments
Jan
on 23 Nov 2017
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
on 23 Nov 2017
Edited: Sergio Manzetti
on 23 Nov 2017
Accepted Answer
More Answers (1)
Sergio Manzetti
on 23 Nov 2017
0 votes
1 Comment
Birdman
on 23 Nov 2017
If the answer is useful, please accept it. And delete this answer. If you want to reply, write it under my answer.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!