Vector convergence in cartesian coordinates

2 visualizzazioni (ultimi 30 giorni)
Yasmin Tamimi
Yasmin Tamimi il 25 Set 2014
Modificato: Yasmin Tamimi il 27 Set 2014
Hey everyone,
How can I help my vector in cartesian coordinates converge to its resting point. The vector flips from +x-axis to the negative but instead of converging to it it keeps rotating around it!
Thanks in advance.
  2 Commenti
Geoff Hayes
Geoff Hayes il 25 Set 2014
Yasmine - you might want to provide some context concerning what problem you are trying to solve. As well, posting some of the code may allow others to get an idea of what is happening and be in a better position to provide/offer some guidance.
Matt J
Matt J il 26 Set 2014
Yasmine Tamimi Commented:
Ok,, so I have a magnetization vector that according to some torques flips from +x-axis to -x-axis.. the problem I'm facing is that it doesn't converge to -x-axis it keeps rotating.. So, what shall I add to help it converge?
Steps = 20000; % Arrays size
time = 100e-9; % Total time
dt = (time/(Steps)); % Time step
Tswitch = 0:dt:time; % in seconds
for t = 1:Steps %Euler's Method
dtheta(t) = dt*((C1*G0)*(hMaz(t) + alpha*hMpol(t))) ; %3.1239
dphi(t) = dt*(((C1*G0)/sin(theta(t)))*(alpha*hMaz(t)- hMpol(t))); %1.57
theta(t+1) = theta(t) + dtheta(t) ; %3.1239
phi(t+1) = phi(t) + dphi(t); %1.57
Mi(t+1) = sin(theta(t+1))*cos(phi(t+1));
Mj(t+1) = sin(theta(t+1))*sin(phi(t+1));
Mk(t+1) = cos(theta(t+1));
u(t+1) = (EAi*Mi(t+1))+(EAj*Mj(t+1))+(EAk*Mk(t+1)); % dot prod. of M and EA.
Anis(t+1) = acos(u(t+1));
epoli(t+1) = cos(theta(t+1))*cos(phi(t+1));
epolj(t+1) = cos(theta(t+1))*sin(phi(t+1));
epolk(t+1) = -sin(theta(t+1));
eazi(t+1) = -sin(phi(t+1));
eazj(t+1) = cos(phi(t+1));
eazk(t+1) = 0 ;
ddu_acos(t+1) = -1/sqrt(1-(u(t+1)^2));
du_dMpol(t+1) = (EAi*cos(theta(t+1))*cos(phi(t+1))+EAj*cos(theta(t+1))*sin(phi(t+1))- EAk*sin(theta(t+1)));
du_dMaz(t+1) = sin(theta(t+1))*(EAj*cos(phi(t+1)) - EAi*sin(phi(t+1)));
dd_Anis(t+1) = Ku*Vol*sin(2*Anis(t+1));
g(t+1) = (-4 + ((1+P)^3)*(3+u(t+1))/(4*(P^1.5))) ;
G(t+1) = 1/g(t+1) ;
Ffi(t+1) = EAj*cos(theta(t+1)) - EAk*sin(theta(t+1))*sin(phi(t+1)) ;
Ffj(t+1) = -EAi*cos(theta(t+1)) + EAk*sin(theta(t+1))*cos(phi(t+1)) ;
Ffk(t+1) = EAi*sin(theta(t+1))*sin(phi(t+1))- EAj*sin(theta(t+1))*cos(phi(t+1)) ;
hMpol(t+1) = - (dd_Anis(t+1) * ddu_acos(t+1) * du_dMpol(t+1))/C2 - ((Is*P_hbar/(2*P_Q*g(t+1)*C2))*((epoli(t+1)*Ffi(t+1))+(epolj(t+1)*Ffj(t+1))+(epolk(t+1)*Ffk(t+1))))- Ms*sin(2*theta(t+1))*((Nx-Nz)+ (Ny-Nx)*(sin(phi(t+1))^2))+((hx*cos(theta(t+1))*cos(phi(t+1))+hy*cos(theta(t+1))*sin(phi(t+1))-hz*sin(theta(t+1))));
hMaz(t+1) = - (dd_Anis(t+1) * ddu_acos(t+1) * du_dMaz(t+1))/(C2*sin(theta(t+1)))- ((Is*P_hbar/(2*P_Q*g(t+1)*C2))*((eazi(t+1)*Ffi(t+1))+(eazj(t+1)*Ffj(t+1))))- Ms*(Ny-Nx)*sin(theta(t+1))*sin(2*phi(t+1))+(hy*cos(phi(t+1)) - hx*sin(phi(t+1))) ;
end

Accedi per commentare.

Risposte (1)

Youssef  Khmou
Youssef Khmou il 25 Set 2014
There are 24 undefined variables C1;G0;hMaz;hMpol;Alpha;theta;phi;EAj;EAi;EAk;Ku;Vol;P;C2;Is;P_hbar;P_Q;Ms;Nx;Nz;Ny;hx;hy;hz;
I tired using random values but the vector hMaz gives NaN values, because we need precise values of these variables, because i think this is inside quantum box right?
  13 Commenti
Youssef  Khmou
Youssef Khmou il 26 Set 2014
Converging M means that the magnetization is zero? what about the volume ?
Yasmin Tamimi
Yasmin Tamimi il 27 Set 2014
Modificato: Yasmin Tamimi il 27 Set 2014
Vector M is position vector initially its M=[Mi Mj Mk]= [1 0 0] and the end result must be [-1 0 0]. The volume stays constant bcz it is the area multiplied by the thickness of the material.

Accedi per commentare.

Categorie

Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by