我自己编的MATLAB程序 一直提示我没有定义变量M,变量M是我要求解的微分方程的因变量,不到该如何定义一下
functionmdoh=DmDh(H,M)M=[];B=2.5e-6;lambdas=1.5e-3;mu0=4e-7*pi;Ms=0.95/mu0;chim=35;Ds...
function mdoh=DmDh(H,M)
M=[];
B=2.5e-6;lambdas=1.5e-3;mu0=4e-7*pi;Ms=0.95/mu0;chim=35;Ds=200e6;Kc=383.3;C=0.18;K=5000*79.6;ATA1=0.02;D=-6.9e6;T=20;x=0.5;Kr=0;
Mst=Ms*(1-(T+273)/(Kc+273))^x./((1-(Kr+273)/(Kc+273))^x);
k=3*chim/Mst;
eta=1/k;
Hemax=2*100*ones(1,10)*1.0e3;
Hei0=linspace(0,max(Hemax),1000);%(取点要足够密)
Mani=[0 Mst.*(coth(Hei0(2:end)/eta)-eta./Hei0(2:end))];
Hspan=[0,5.57*1.0e4];
Hei=Hspan(2:end)+ATA1.*Mani-2*B*T*D.* Mani/mu0/Ms^2+(4*D-Ds*log(cosh(2*D/Ds)))*lambdas.*Mani/2/mu0/Ms^2;
DManDHei=[0 Mst.*((-(csc(Hei0(2:end)./eta)).^2)/eta+eta./(Hei0(2:end)).^2)];
He=linspace(0,100,1000);
Man=spline(Hei,Mani,He);
DManDHe=spline(Hei,DManDHei,He);
KSC=1;
C=0.18;
K=5000*79.6;
ATA1=0.02;
ATA2=ATA1-2*B*T*D/mu0/Ms^2+(4*D-Ds*log(cosh(2*D/Ds)))*lambdas/2/mu0/Ms^2;
mdoh=(Man-M+KSC*K*C*DManDHe)/(KSC*K-ATA2*(Man-M+KSC*K*C*DManDHe));
Hspan=[0,5.57*1.0e4];
[HH,MM]=ode45(@DmDh,Hspan,6e6);
plot(HH,MM(:,1),title('H')) 展开
M=[];
B=2.5e-6;lambdas=1.5e-3;mu0=4e-7*pi;Ms=0.95/mu0;chim=35;Ds=200e6;Kc=383.3;C=0.18;K=5000*79.6;ATA1=0.02;D=-6.9e6;T=20;x=0.5;Kr=0;
Mst=Ms*(1-(T+273)/(Kc+273))^x./((1-(Kr+273)/(Kc+273))^x);
k=3*chim/Mst;
eta=1/k;
Hemax=2*100*ones(1,10)*1.0e3;
Hei0=linspace(0,max(Hemax),1000);%(取点要足够密)
Mani=[0 Mst.*(coth(Hei0(2:end)/eta)-eta./Hei0(2:end))];
Hspan=[0,5.57*1.0e4];
Hei=Hspan(2:end)+ATA1.*Mani-2*B*T*D.* Mani/mu0/Ms^2+(4*D-Ds*log(cosh(2*D/Ds)))*lambdas.*Mani/2/mu0/Ms^2;
DManDHei=[0 Mst.*((-(csc(Hei0(2:end)./eta)).^2)/eta+eta./(Hei0(2:end)).^2)];
He=linspace(0,100,1000);
Man=spline(Hei,Mani,He);
DManDHe=spline(Hei,DManDHei,He);
KSC=1;
C=0.18;
K=5000*79.6;
ATA1=0.02;
ATA2=ATA1-2*B*T*D/mu0/Ms^2+(4*D-Ds*log(cosh(2*D/Ds)))*lambdas/2/mu0/Ms^2;
mdoh=(Man-M+KSC*K*C*DManDHe)/(KSC*K-ATA2*(Man-M+KSC*K*C*DManDHe));
Hspan=[0,5.57*1.0e4];
[HH,MM]=ode45(@DmDh,Hspan,6e6);
plot(HH,MM(:,1),title('H')) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询