作业帮 > 综合 > 作业

Matlab求助:怎么把程序中的点连成线

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/18 18:57:35
Matlab求助:怎么把程序中的点连成线
m = 4000;
g = 10;
L = 4;
Peak_force_min = inf;
Peak_force = 0;
for delta = 40:0.5:85
for theta = -20:0.5:80
c2 = (2.2^2 - 1.2^2)/(cosd(delta - 20) - cosd(delta + 80));
c1 = 2.2^2 + c2*cosd(delta +80);
a = ((c1 + c2)^0.5 + (c1 - c2)^0.5)/2;
b = c2/(2*a);
r = sqrt(a^2 + b^2 - 2*a*b*cosd(theta + delta));
F = r*m*g*L*cosd(theta)/(a*b*sind(theta + delta));
if F > Peak_force
Peak_force = F;
end
end
if Peak_force_min > Peak_force
Peak_force_min = Peak_force;
end
plot(delta,Peak_force,'k-'),grid on;
hold on
Peak_force=0;
end
disp(Peak_force_min)
感觉是因为每次输出一个点,然后用hold on保持住了.但怎么才能输出一条曲线呢?
Matlab求助:怎么把程序中的点连成线
delta = 40:0.5:85;
theta = linspace(-20,80,length(delta));
c2 = (2.2^2 - 1.2^2)./(cosd(delta - 20) - cosd(delta + 80));
c1 = 2.2^2 + c2.*cosd(delta +80);
a = ((c1 + c2).^0.5 + (c1 - c2).^0.5)/2;
b = c2./(2*a);
r = sqrt(a.^2 + b.^2 - 2*a.*b.*cosd(theta + delta));
F = r.*m*g*L.*cosd(theta)./(a.*b.*sind(theta + delta));
Peak_force = F(F > Peak_force);
Peak_force_min = Peak_force(Peak_force_min > Peak_force);
plot(delta,Peak_force,'k-'), grid on;
disp(min(Peak_force_min))
按上面语句试试