作业帮 > 综合 > 作业

matlab for 循环

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 15:47:06
matlab for 循环
那个end出错的问题自己解决了.现在多了其他问题.我是这样写的.
for i=1:9
x(i)=cos(j(i)/180)
y(i)=sin(j(i)/180)
[o,p,q,dx,dy,dz,ex,ey,ez]=fsolve('[0:x(i)-o;0:y(i)-p;0:0-q]*[0;dx;0;dy;0:dz]=norm([0:x(i)-o;0:y(i)-p;0:0-q])*cos(d(i))','[0:x(i)-o;0:y(i)-p;0:0-q]*[0;ex;0;ey;0:ez]=norm([0:x(i)-o;0:y(i)-p;0:0-q])*cos(c(i))','[0;dx;0;dy;0:dz]*[0;ex;0;ey;0:ez]=0')
end
提示
Error using fsolve
Too many output arguments.
请问怎么修改,让其解出[o,p,q,dx,dy,dz,ex,ey,ez]这9个值?
matlab for 循环
for i=1:9
x(i)=cos(i)/180
y(i)=sin(i)/180
[o,p,q,dx,dy,dz,ex,ey,ez]=fsolve('[0:x(i)-o;0:y(i)-p;0:0-q]*[0;dx;0;dy;0:dz]=norm([0:x(i)-o;0:y(i)-p;0:0-q])*cos(d(i))','[0:x(i)-o;0:y(i)-p;0:0-q]*[0;ex;0;ey;0:ez]=norm([0:x(i)-o;0:y(i)-p;0:0-q])*cos(c(i))','[0;dx;0;dy;0:dz]*[0;ex;0;ey;0:ez]=0')
end
你好,你可以将你要求解的函数写成A*x = b 的形式 然后利用x = A\b或者x = inv(A)*