Created
October 19, 2018 01:17
-
-
Save Hugo-Diaz-N/0168c2c90c4e8e19c3694636069b2e24 to your computer and use it in GitHub Desktop.
Movement particle on a sphere surface under a force F
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Problem: find u s.t. | |
% \frac{d}{dt}{\bf u}(t)+\alpha {\bf u}(t)\times \frac{d}{dt}{\bf u}(t)&={\bf u}(t)\times {\bf F}(t) | |
% initial position u_0=0.5*\sqrt(2)(0 1 1)^t | |
F=[0 0 10]'; % constant case | |
u0=0.5*sqrt(2)*[0 1 1]'; | |
a=0.1; % alpha in the PDE | |
b=(1/(1+a*a*norm(u0,2)^2)); | |
f=@(t,u) b*(cross(u,F)-a*(F'*u)*u+a*norm(u)^2*F); | |
[t,w]=ode23s(f,[0,10],u0); | |
w=w'; | |
x1 = w(1,:); | |
x2 = w(2,:); | |
x3 = w(3,:); | |
hold on | |
sphere(40) | |
plot3(x1,x2,x3,'-sk','LineWidth',2) | |
view(-90,90) | |
figure | |
plot(t,x1,'-.r',t,x2,'-.b',t,x3,'-.k','LineWidth',2) | |
w=w.^2; w=sqrt(sum(w)); | |
figure | |
plot(t,w,'.-k') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment