Hi, matlab person,I have some problems about second order variable coefficients ODE.
Thank you very much for any suggestion or help.
equation: x^2 y''+x y'-sin(y)cos(y)+4*k/pi*x sin(y)^2-x^2 sin(y)cos(y)=0boundary condition: y(0)=0;y'(0)=-0.126
The following is my code, but there are several problem:
first defining function *********************************************
function yprime = skyrmion(x,y)k=0.95;yprime = [y(2); -1/x*y(2)+1/x^2*sin(y(1))*cos(y(1))-4*k/pi* (1/x)*sin(y(1))^2+sin(y(1))*cos(y(1))];
*********************************************************
Then transfer function
*****************************************************
xspan=[0.01,10];y0=[-0.126;pi];[x,y]=ode45('skyrmion',xspan,y0);plot(x(:),y(:,2))
****************************************************
problem one:
Because The ODE was divided by x^2, so the x span can't use x==0. whether the code can be modified to not divide x^2.
problem two:
the results get by using my code are not consist with some papers.
so I want to know my code is right or wrong.
Best Answer