matlab编写的函数,当传输参数为矩阵时,运行总是出错,跪求大神解释
functionxuanzhuanjuzhen=rotation3(xa,ya,za)%计算三维空间以原点为旋转中心旋转(xangle,yangle,zangel)角度,...
function xuanzhuanjuzhen=rotation3(xa,ya,za)
%计算三维空间以原点为旋转中心旋转(xangle,yangle,zangel)角度,即先后绕x,y,z轴旋转对应角度
%求旋转(xangle,yangle,zangel)角度后的点的格式为[x*,y*,z*]=xuanzhuanjizhen*[x,y,z];
z=[cos(za),-sin(za),0;sin(za),cos(za),0;0,0,1];
y=[cos(ya),0,-sin(ya);0,1,0;sin(ya),0,cos(ya)];
x=[1,0,0;0,cos(xa),-sin(xa);0,sin(xa),cos(xa)];
xuanzhuanjuzhen=x*y*z;
运行之后:
??? Error using ==> vertcat
All rows in the bracketed expression must have the same
number of columns. 展开
%计算三维空间以原点为旋转中心旋转(xangle,yangle,zangel)角度,即先后绕x,y,z轴旋转对应角度
%求旋转(xangle,yangle,zangel)角度后的点的格式为[x*,y*,z*]=xuanzhuanjizhen*[x,y,z];
z=[cos(za),-sin(za),0;sin(za),cos(za),0;0,0,1];
y=[cos(ya),0,-sin(ya);0,1,0;sin(ya),0,cos(ya)];
x=[1,0,0;0,cos(xa),-sin(xa);0,sin(xa),cos(xa)];
xuanzhuanjuzhen=x*y*z;
运行之后:
??? Error using ==> vertcat
All rows in the bracketed expression must have the same
number of columns. 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询