int function causes errors

1 次查看(过去 30 天)
Yasmin Tamimi
Yasmin Tamimi 2013-11-11
Dear All,
I'm not able to integrate the equations although I'm using symbols. The following is the code that resembles the LLG equation:
syms Mtheta Mphi
syms hMtheta hMphi
syms theta phi Anis
syms Mx My Mz u ethetax ethetay ethetaz ephix ephiy ephiz
syms ddu_acos dd_Anis du_dMtheta du_dMphi
syms g Ff Ffx Ffy Ffz
syms u1
%define the constants
P_gamma =1.76e11;
P_hbar =1.054e-34;
P_U0 = 4e-7*pi;
P_Q = 1.6e-19;
a1 = 100e-9 ;
b1 = 50e-9 ;
Area = a1*b1*pi ;
t1 = 3.0e-9 ;
Ms = 8e5 ;
Ku = 300.0 ;
alpha = 0.02 ;
Vol = Area*t1 ;
C1 = 1/(1+(alpha^2));
C2 =P_U0*Vol*Ms ;
G0 = P_gamma*P_U0;
Nx = 0.0182;
Ny = 0.0515;
Nz = 0.931;
EAx = 1;
EAy = 0;
EAz = 0;
EA = [EAx EAy EAz];
P = 0.35; Is = 700e-6;
%Define the equations
Mx = sin(Mtheta)*cos(Mphi);
My = sin(Mtheta)*sin(Mphi);
Mz = cos(Mtheta);
M = [Mx My Mz];
%u = (EAx*Mx)+(EAy*My)+(EAz*Mz); %Magnetic Moment dot product the easy axis %u = EA .* M;
u1 = dot(EA,M);
Anis = acos(u1); % psi= the angle between the magnetic moment and the easy axis
% (du/dtheta) ethetax = cos(Mtheta)*cos(Mphi);
ethetay = cos(Mtheta)*sin(Mphi);
ethetaz = -sin(Mtheta);
etheta = [ethetax ethetay ethetaz];
% (du/dphi) ephix = -sin(Mphi);
ephiy = cos(Mphi);
ephiz = 0 ;
ephi = [ephix ephiy ephiz];
ddu_acos = -1/sqrt(1-(u1^2)); % d(arccos(u))/du
du_dMtheta = (EAx*cos(Mtheta)*cos(Mphi)+EAy*cos(Mtheta)*sin(Mphi)- EAz*sin(Mtheta)); %(du/dtheta)
du_dMphi = (-EAx*sin(Mphi)*sin(Mtheta)) + (EAy*cos(Mphi)*sin(Mtheta)); % (du/dphi)
dd_Anis = Ku*Vol*sin(2*(Anis));
g = 1/(-4 + ((1+P)^3)*(3+u1)/(4*(P^1.5))) ;
Ffx = EAy*cos(Mtheta) - EAz*sin(Mtheta)*sin(Mphi) ;
Ffy = -EAx*cos(Mtheta) + EAz*sin(Mtheta)*cos(Mphi) ;
Ffz = EAy*sin(Mtheta)*sin(Mphi) - EAy*sin(Mphi)*cos(Mphi) ;
Ff = ( Ffx + Ffy + Ffz );
hMtheta = - (dd_Anis * ddu_acos * du_dMtheta)/C2 - ((Is*P_hbar/(2*P_Q*g*C2))*((ethetax*Ffx)+(ethetay*Ffy)+(ethetaz*Ffz))) - Ms*sin(2*Mtheta)*((Nx-Nz)+ (Ny-Nx)*(sin(Mphi)^2));
hMphi = - (dd_Anis * ddu_acos * du_dMphi)/(C2*sin(Mtheta)) - ((Is*P_hbar/(2*P_Q*g*C2))*((ephix*Ffx)+(ephiy*Ffy))) - Ms*(Ny-Nx)*sin(Mtheta)*sin(2*Mphi);
Mtheta = int((C1*G0)*((hMphi) + alpha*(hMtheta))) ; %3.1239
Mphi = int(((C1*G0)/sin((Mtheta)))*(alpha*(hMphi)- (hMtheta))); %1.57

回答(1 个)

Walter Roberson
Walter Roberson 2013-11-11
By the time you get down to the integral in your second last line, the formula to be integrated is in terms of two symbolic variables, Mtheta and Mphi. You have not specified which variable to integrate with respect to, for either one.
If you do specify that you want to be integrated with respect to Mtheta, then you should not expect that you will have a closed form solution.
You assign the output of the first integral to Mtheta. In the second integral you use Mtheta, which has just been assigned to. In the symbols which defined previously in terms of Mtheta, should the old Mtheta definition be used, or the one that was just assigned? If you do want to use the new value, I suggest that you assign to something other than Mtheta here, and subs() that in for Mtheta in the expression to be integrated in the last line.
You probably should not be expecting a closed form solution for Mphi either.
  3 个评论
Walter Roberson
Walter Roberson 2013-11-13
How do you want to proceed? Substitute in a particular value for Mphi and do the integration to find a provisional Mtheta value, and substitute that Mtheta value into the integral for Mphi to obtain a provisional Mphi value, and keep going around like that until you find a fixed point where the two resolve to the same Mtheta and Mphi pair?
Yasmin Tamimi
Yasmin Tamimi 2013-11-13
编辑:Yasmin Tamimi 2013-11-13
If I take one iteration: Initially I want to start with Mtheta=0.0017 and Mphi=1.57. These two values of Mtheta and Mphi correspond to a parallel state. I integrate the two equations because they change with time. Now the new value of Mtheta will take both the previous initial values. Same for Mphi it will take the previous initial values. After several iterations i will end up with new values for both variables that correspond to an anti-parallel state. The current itself is a function of the angle but for simplicity and for making it work initially I considered it constant in here.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by