how solve this problem in code execution
Show older comments
i have error in the following program
function dMt = fcn(dB,B,H, M, dH)
if dB~=0;
deltaB =1
k1=0.011;
k2=0.49;
mui0=4*pi*10e-07;
psi=30;
Ms=1.22e06;
alpha=5e-4;
L=3;
a=200;
c=0.6;
syms theta E1 E2 Ms theta
% theta=30;
Kan=4.03e4;
He=H+alpha*M;
p=k1*dB+deltaB*k2*abs(sqrt(dB));
E1=(He/a)*cos(theta)-(Kan/Ms*mui0*a)*sin(psi-theta)*sin(psi-theta);
E2=(He/a)*cos(theta)-(Kan/Ms*mui0*a)*sin(psi+theta)*sin(psi+theta);
% E1 = sym('E1');
% E2 = sym('E2');
% Ms = sym('Ms');
f1 = sin(theta)*cos(theta)*exp(E1 + E2);
f2 = sin(theta)*exp(E1 + E2);
Man = Ms * int(f1, 0, pi) / int(f2, 0, pi);
dMan=(Ms/a)*(1-coth(He/a)*coth(He/a)+(a/He)^2);
Mirr=(M-c*Man)/(1-c);
if((Man-Mirr)*dB)<0
dM=((c/mui0)*dMan)/(1-c*(alpha-1)*dMan);
else dM=(M-Man-(k*deltaB*c/(1-c))*(dMan)+p)/(mui0*(alpha-1)*(Man-M+(k*deltaB*c/(1-c))*(dMan)-(mui0*k*deltaB/(1-c))));
end
end
dMt =dM*dB;
Conversion to logical from sym is not possible.
Error in fcn (line 29)
if((Man-Mirr)*dB)<0
any one can help
Accepted Answer
More Answers (0)
Categories
Find more on Symbolic Variables, Expressions, Functions, and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!