Matlabwilliam hill官网
直播中

刘跃

7年用户 88经验值
擅长:可编程逻辑
私信 关注
[问答]

为什么画不出图形呢,没有报错啊

L=460;
alpha=pi/3;
x=[];
y=[];
z=[];
for m=1:100
for n=0:100
     for p=1:100
         for q=0:100
  theta1=1/100*pi*m;
   delta1=1/25*pi*n;
   theta2=1/100*pi*p;
   delta2=1/25*pi*q;
x=(L*(sin(theta2) - 1)*(sin(alpha - delta1 + delta2)*sin(delta1) - cos(alpha - delta1 + delta2)*cos(delta1)*sin(theta1)))/(pi/2 - theta2) - (L*cos(delta1)*(sin(theta1) - 1))/(pi/2 - theta1) + (L*cos(delta1)*cos(theta1)*cos(theta2))/(pi/2 - theta2);
y=(L*sin(delta1)*cos(theta1)*cos(theta2))/(pi/2 - theta2) - (L*(sin(theta2) - 1)*(sin(alpha - delta1 + delta2)*cos(delta1) + cos(alpha - delta1 + delta2)*sin(delta1)*sin(theta1)))/(pi/2 - theta2) - (L*sin(delta1)*(sin(theta1) - 1))/(pi/2 - theta1);
z=(L*cos(theta1))/(pi/2 - theta1) + (L*cos(theta2)*sin(theta1))/(pi/2 - theta2) + (L*cos(alpha - delta1 + delta2)*cos(theta1)*(sin(theta2) - 1))/(pi/2 - theta2);

         end
      end
end
end
plot3(x,y,z);hold on;grid on

回帖(1)

yinhuakeli

2018-5-16 19:28:59
不是没画出图形,是你的x、y、z没赋值成数组,还有你这用了四重循环,应该没写对,应该一重循环就够了。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分