Using MATLAB to solve differential equations dx/dt=x-y-x(x^2+y^2) dy/dt=x+y-y(x^2+y^2) x(0)=2 y(0)1

Using MATLAB to solve differential equations dx/dt=x-y-x(x^2+y^2) dy/dt=x+y-y(x^2+y^2) x(0)=2 y(0)1

[x,y]=dsolve('Dx=x-y-x*(x^2+y^2)','Dy=x+y-y*(x^2+y^2)','x(0)=2','y(0)=1')
The result is that the analytic solution is not found
Numerical solution is used
In MATLAB input: edit, and then the following two lines between the percent sign, copy in, save
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function y=zhidao_ rk4_ 5(t,x)
%x. Y variables are expressed by X (1) and X (2) respectively
y=[x(1)-x(2)-x(1)*(x(1)^2+x(2)^2);x(1)+x(2)-x(2)*(x(1)^2+x(2)^2)];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Under Matlab, input:
t_ end=10;
x0=[2;1];
[t,x]=ode45('zhidao_ rk4_ 5',[0,t_ end],x0);
plot(t,x);
legend('x','y');
xlabel('t');
figure;
plot(x(:,1),x(:,2));
xlabel('x');
ylabel('y');