matlab if else语句为什么只运行最后一个,急x1=normrnd(29.6,4.4,10000,1);x2=normrnd(1,0.2,10000,1);x3=normrnd(0.3,0.045,10000,1);y=zeros(10000,1);for i=1:10000for j=1if(0.19875>x3&x3>=0.165)y(i,j)=0.0026*x1(i,j)^2+2.5*x2(i,j)^2+175.5831*x3(
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/28 04:30:01
matlab if else语句为什么只运行最后一个,急x1=normrnd(29.6,4.4,10000,1);x2=normrnd(1,0.2,10000,1);x3=normrnd(0.3,0.045,10000,1);y=zeros(10000,1);for i=1:10000for j=1if(0.19875>x3&x3>=0.165)y(i,j)=0.0026*x1(i,j)^2+2.5*x2(i,j)^2+175.5831*x3(
matlab if else语句为什么只运行最后一个,急
x1=normrnd(29.6,4.4,10000,1);
x2=normrnd(1,0.2,10000,1);
x3=normrnd(0.3,0.045,10000,1);
y=zeros(10000,1);
for i=1:10000
for j=1
if(0.19875>x3&x3>=0.165)
y(i,j)=0.0026*x1(i,j)^2+2.5*x2(i,j)^2+175.5831*x3(i,j)^2-0.2552*x1(i,j)-8.5*x2(i,j)-78.6832*x3(i,j)+38.5936;
else if(0.2325>x3&x3>=0.19875)
y(i,j)=-0.0026*x1(i,j)^2+5*x2(i,j)^2-175.583*x3(i,j)^2-0.0403*x1(i,j)-13.5*x2(i,j)+43.1276*x3(i,j)+28.9196;
else if(0.26625>x3&x3>=0.2325)
y(i,j)=-0.0155*x1(i,j)^2-1.25*x2(i,j)^2-2282.58*x3(i,j)^2+0.553719*x1(i,j)-1.25*x2(i,j)+1076.214*x3(i,j)-109.645;
else if(0.3>x3&x3>=0.26625)
y(i,j)=-0.0155*x1(i,j)^2+2.5*x2(i,j)^2-3511.66*x3(i,j)^2+0.440083*x1(i,j)-8.5*x2(i,j)+1923.292*x3(i,j)-241.188;
else if(0.33375>x3&x3>=0.3)
y(i,j)=-0.04132*x1(i,j)^2-16.25*x2(i,j)^2-6320.99*x3(i,j)^2+1.219008*x1(i,j)+26.75*x2(i,j)+3762.963*x3(i,j)-557.178;
else if(0.3675>x3&x3>=0.33375)
y(i,j)=0.149793*x1(i,j)^2+5*x2(i,j)^2+3.64e-12*x3(i,j)^2-9.59504*x1(i,j)-15*x2(i,j)-4.5e-12*x3(i,j)+167.7702;
else if(0.40125>x3&x3>=0.3675)
y(i,j)=0.002583*x1(i,j)^2+5*x2(i,j)^2+7.28e-12*x3(i,j)^2-0.23244*x1(i,j)-15*x2(i,j)-0*x3(i,j)+19.61736;
else
y(i,j)=0.002583*x1(i,j)^2+5*x2(i,j)^2-1.8e-12*x3(i,j)^2-0.23244*x1(i,j)-15*x2(i,j)+0*x3(i,j)+19.61736;
end
end
end
end
end
end
end
end
end
matlab if else语句为什么只运行最后一个,急x1=normrnd(29.6,4.4,10000,1);x2=normrnd(1,0.2,10000,1);x3=normrnd(0.3,0.045,10000,1);y=zeros(10000,1);for i=1:10000for j=1if(0.19875>x3&x3>=0.165)y(i,j)=0.0026*x1(i,j)^2+2.5*x2(i,j)^2+175.5831*x3(
else if必须连着一起,写成 elseif,不能分开.