In that code that define the function equation:
Landlord: dxdt = [x (1) * (1-x (1)) * (2 * x (3)+1; x(2)*( 1-x(2))*(3 * x(3)+ 1; x(3)*( 1-x(3))*(- 1 * x( 1)-x(2)-x( 1)* x(2)+4)];
After revision: dxdt = [x (1) * (1-x (1)) * (2 * x (3)+1); x(2)*( 1-x(2))*(3 * x(3)+ 1); x(3)*( 1-x(3))*(- 1 * x( 1)-x(2)-x( 1)* x(2)+4)];
Error reason: In the first two semicolons ";" Before, the closing bracket ")" is missing.
The function X needs to pass three parameters like x( 1) x(2) x(3), but when the landlord calls the ode45 function in the main program, only two parameters, I and J, are passed, and the variable K can be introduced. Take x-y-z as an example, change it to the following (the modified part is bold), and the other parts are the same:
%z-y-x
For i=0:0. 1: 1
For j=0:0. 1: 1
For k=0:0. 1: 1
[T, Y]=ode45 ('differential', [0.5], [IJK]);
Figure (1)
Grid open
plot3(Y(:, 1),Y(:,2),Y(:,3);
continue
end
end
end