1

I found this code from a Chua attractor in matlab, but for a project I need to work it in Python. It happens that I don't understand how Ode45 works in this case and I haven't been able to translate it to its equivalent in python, could you explain how to do it, please?

%----------Chua.m----------
function out = chua(t,in)

x = in(1);
y = in(2);
z = in(3);

alpha  = 15.6;
beta   = 28; 
m0     = -1.143;
m1     = -0.714;

h = m1*x+0.5*(m0-m1)*(abs(x+1)-abs(x-1));

xdot = alpha*(y-x-h);
ydot = x - y+ z;
zdot  = -beta*y;

out = [xdot ydot zdot]';
%----------StartChua.m----------
[t,y] = ode45(@chua,[0 100],[0.7 0 0]);
plot3(y(:,1),y(:,2),y(:,3))
grid

0 Answers0