matlab 提示说内矩阵维度不一致.方程:function y=f(m1,m2,j)g=9.8;y=[0,m1*g,0,m2*g]'*inv([m1*cos(j),-m1,-sin(j),0;m1*sin(j),0,cos(j),0;0,m2,-sin(j),0;0,0,-cos(j),1])y结果:>> hanshu(12,12,8)? Error using ==> mtimesInner matrix dimension
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 11:58:17
matlab 提示说内矩阵维度不一致.方程:function y=f(m1,m2,j)g=9.8;y=[0,m1*g,0,m2*g]'*inv([m1*cos(j),-m1,-sin(j),0;m1*sin(j),0,cos(j),0;0,m2,-sin(j),0;0,0,-cos(j),1])y结果:>> hanshu(12,12,8)? Error using ==> mtimesInner matrix dimension
matlab 提示说内矩阵维度不一致.
方程:
function y=f(m1,m2,j)
g=9.8;
y=[0,m1*g,0,m2*g]'*inv([m1*cos(j),-m1,-sin(j),0;m1*sin(j),0,cos(j),0;0,m2,-sin(j),0;0,0,-cos(j),1])
y
结果:
>> hanshu(12,12,8)
? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> hanshu at 3
y=[0,m1*g,0,m2*g]'*inv([m1*cos(j),-m1,-sin(j),0;m1*sin(j),0,cos(j),0;0,m2,-sin(j),0;0,0,-cos(j),1])
>>
matlab 提示说内矩阵维度不一致.方程:function y=f(m1,m2,j)g=9.8;y=[0,m1*g,0,m2*g]'*inv([m1*cos(j),-m1,-sin(j),0;m1*sin(j),0,cos(j),0;0,m2,-sin(j),0;0,0,-cos(j),1])y结果:>> hanshu(12,12,8)? Error using ==> mtimesInner matrix dimension
[0,m1*g,0,m2*g]'
不要转置,直接[0,m1*g,0,m2*g]就好