matlab多变量函数求最值Attempt to access minimum(-20,0,1.2)index must be a positive integer logical求最小受力 minimum的值,刚刚接触matlab,r = 1.2:0.01:2.2;theta = -20:1:80;delta = 0:1:100;m = 4;g = 9.8;L = 4;c2 = (2.2^2 - 1.2^2)./(co
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/15 07:48:58
matlab多变量函数求最值Attempt to access minimum(-20,0,1.2)index must be a positive integer logical求最小受力 minimum的值,刚刚接触matlab,r = 1.2:0.01:2.2;theta = -20:1:80;delta = 0:1:100;m = 4;g = 9.8;L = 4;c2 = (2.2^2 - 1.2^2)./(co
matlab多变量函数求最值Attempt to access minimum(-20,0,1.2)index must be a positive integer logical
求最小受力 minimum的值,刚刚接触matlab,
r = 1.2:0.01:2.2;
theta = -20:1:80;
delta = 0:1:100;
m = 4;
g = 9.8;
L = 4;
c2 = (2.2^2 - 1.2^2)./(cos(delta - 20) - cos(delta + 80));
c1 = 2.2^2 + c2.*cos(delta +80);
a = (sqrt(c1 +c2) + sqrt(c1 - c2))/2;
b = c2/(2*a);
x = 1000000;
for theta = -20:1:100
for delta = 0:1:100
for r = 1.2:0.01:2.2
minimum = m.*r*g*L.*cos(theta)'./a.*b.*sin(theta + delta);
if minimum(theta,delta,r) < x
x = minimum(theta,delta,r);
end
end
end
end
disp (x)
matlab多变量函数求最值Attempt to access minimum(-20,0,1.2)index must be a positive integer logical求最小受力 minimum的值,刚刚接触matlab,r = 1.2:0.01:2.2;theta = -20:1:80;delta = 0:1:100;m = 4;g = 9.8;L = 4;c2 = (2.2^2 - 1.2^2)./(co
minimum(theta,delta,r)
下标只能是正数.你的theta & r都不符合要求,你的minimun是一个数组,而不是一个函数
if minimum < x
x = minimum;
end
改成这样子试试