Use Ode 45 in Chua's system with non linear function need to be solved but I don't know how iterate the non linear function in loop?

5 次查看(过去 30 天)
[t,x] = ode45(@chua_function,[0 150],[0.1 0.1 0]);
plot3(x(:,1),x(:,2),x(:,3),'r')
title(" Chua's circuit")
xlabel('x')
ylabel('y')
zlabel('zr')
grid
function out = chua_function(~,p)
a = 9;
B = 14.28;
m0 = 0.128;
m1= -0.42;
m2= 2;
m3= - 0.38;
m4= 0.57;
m5= -0.342;
e1 = 1;
e2 = 2.15;
e3 = 3.6;
e4 = 6.2;
e5 = 9;
x = p(1);
y = p(2);
z = p(3);
g = (m5)*x+0.5*((m0 - m1)*(abs(x+e1)-abs(x-e1))) +(0.5)*((m1- m2)*(abs(x+e2)-abs(x-e2)))
+(0.5)*((m2 - m3)*(abs(x+e3)-abs(x-e3)))+(0.5)*((m3 - m4)*(abs(x+e4)-abs(x-e4)))
+(0.5)*((m4 - m5)*(abs(x+e5)-abs(x-e5)));
%g = (m5)*x+0.5*((m0 - m1)*(abs(x+e1)-abs(x-e1)))
xdot = a*(y-g);
ydot = x - y+ z;
zdot = -B*y;
out = [xdot ydot zdot]';
end

采纳的回答

Torsten
Torsten 2022-12-5
[t,x] = ode45(@chua_function,[0 150],[0.1 0.1 0]);
plot3(x(:,1),x(:,2),x(:,3),'r')
title(" Chua's circuit")
xlabel('x')
ylabel('y')
zlabel('zr')
grid
function xdot = chua_function(~,x)
eta = 9;
zeta = -14.28;
m = [0.9,-3,3.5,-2.7,4,-2.4]/7;
E = [1,2.15,3.6,6.2,9];
phix1 = m(end)*x(1) + 0.5*sum((m(1:end-1)-m(2:end)).*(abs(x(1)+E(1:end))-abs(x(1)-E(1:end))));
xdot = zeros(3,1);
xdot(1) = eta*(x(2)-phix1);
xdot(2) = x(1) - x(2) + x(3);
xdot(3) = zeta*x(2);
end
  6 个评论
kathiresan
kathiresan 2022-12-13
I have tried same for my response system for same time step with conrol but its not give the same solution vector , do i need to switch to eulers method its goof or ode45 is enough to solve drive and respone system in same time step ???
could you clarify or modify this code to euler method??
Torsten
Torsten 2022-12-13
编辑:Torsten 2022-12-13
Call ode45 in a loop from t0 to t1, t1 to t2,... and set the initial conditions for y1,y2 and y3 for the new time step from t_k to t_(k+1) as the results from the previous time step + gamma*e_i(t_k) (i=1,2,3).

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by