x=0:pi/100:2pi;
h=[];
for x0=x;
if x0>=0&&x0<=pi/2
h=[h,(28.5*sin(x0).^2+(28.5^2*cos(x0).^4+(64^2-28.5*28.5)*cos(x0).^2).^(1/2))/64];
X=(64^2+28.5^2-2*64*28.5*h).^(1/2);
elseif x0>pi/2&&x0<=1.776
h=[h,(28.5*sin(x0).^2-(28.5^2*cos(x0).^4+(64^2-28.5*28.5)*cos(x0).^2).^(1/2))/64];
X=(64^2+28.5^2-2*64*28.5*h).^(1/2);
elseif x0>1.776&&x0<=2.2
h=[h,36*cos(2.2-x0)+(36^2*cos(2.2-x0).^2-36^2+34^2).^(1/2)];
X=h;
elseif x0>2.2&&x0<=4.08
h=[h,70];
X=h;
elseif x0>4.08&&x0<=4.51
h=[h,36*cos(4.51-x0)+(36^2*cos(4.51-x0).^2-36^2+34^2).^(1/2)];
X=h;
elseif x0>4.51&&x0<1.5pi
h=[h,(28.5sin(x0).^2-(28.5^2cos(x0).^4+3283.75cos(x0).^2).^(1/2))/64];
X=(64^2+28.5^2-26428.5h).^(1/2);
else
h=[h,(28.5sin(x0).^2+(28.5^2cos(x0).^4+3283.75cos(x0).^2).^(1/2))/64];
X=(64^2+28.5^2-26428.5h).^(1/2);
end
end;
S=acos((199.4^2+201^2-X.^2)/2/199.4/201);
plot(x,S);
[](
))
为什么X数组会突然变小呢。
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- 技术专家团-Joel 2022-04-06 20:40关注
你看看是不是这样做的
x=0:pi/100:2*pi; h=[]; X = []; for x0=x if x0>=0&&x0<=pi/2 h=[h,(28.5*sin(x0).^2+(28.5^2*cos(x0).^4+(64^2-28.5*28.5)*cos(x0).^2).^(1/2))/64]; X=[X;(64^2+28.5^2-2*64*28.5*h(end)).^(1/2)]; elseif x0>pi/2&&x0<=1.776 h=[h,(28.5*sin(x0).^2-(28.5^2*cos(x0).^4+(64^2-28.5*28.5)*cos(x0).^2).^(1/2))/64]; X=[X;(64^2+28.5^2-2*64*28.5*h(end)).^(1/2)]; elseif x0>1.776&&x0<=2.2 h=[h,36*cos(2.2-x0)+(36^2*cos(2.2-x0).^2-36^2+34^2).^(1/2)]; X=[X;h(end)]; elseif x0>2.2&&x0<=4.08 h=[h,70]; X=[X;h(end)]; elseif x0>4.08&&x0<=4.51 h=[h,36*cos(4.51-x0)+(36^2*cos(4.51-x0).^2-36^2+34^2).^(1/2)]; X=[X;h(end)]; elseif x0>4.51&&x0<1.5*pi h=[h,(28.5*sin(x0).^2-(28.5^2*cos(x0).^4+3283.75*cos(x0).^2).^(1/2))/64]; X=[X;(64^2+28.5^2-26428.5*h(end)).^(1/2)]; else h=[h,(28.5*sin(x0).^2+(28.5^2*cos(x0).^4+3283.75*cos(x0).^2).^(1/2))/64]; X=[X;(64^2+28.5^2-26428.5*h(end)).^(1/2)]; end end S=acos((199.4^2+201^2-X.^2)/2/199.4/201); plot(x,S);
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
- ¥20 关于URL获取的参数,无法执行二选一查询
- ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
- ¥15 marlin编译错误,如何解决?
- ¥15 有偿四位数,节约算法和扫描算法
- ¥15 VUE项目怎么运行,系统打不开
- ¥50 pointpillars等目标检测算法怎么融合注意力机制
- ¥20 Vs code Mac系统 PHP Debug调试环境配置
- ¥60 大一项目课,微信小程序
- ¥15 求视频摘要youtube和ovp数据集