matlab计算时出现“ Error using ==> mpower Inputs must be a scalar and a square matrix.”a =[ -0.0881,-2.1214 ,-1.4637,-3.4110,-2.0793]; b =[0.1527,0.3555,0.4291,0.1678,0.3078]; r =[-0.0963,-0.3700,-0.0963,-0.2179,-0.3438]; J=[(a^2)*j3+(b^2)*j1
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 10:20:51
matlab计算时出现“ Error using ==> mpower Inputs must be a scalar and a square matrix.”a =[ -0.0881,-2.1214 ,-1.4637,-3.4110,-2.0793]; b =[0.1527,0.3555,0.4291,0.1678,0.3078]; r =[-0.0963,-0.3700,-0.0963,-0.2179,-0.3438]; J=[(a^2)*j3+(b^2)*j1
matlab计算时出现“ Error using ==> mpower Inputs must be a scalar and a square matrix.”
a =[ -0.0881,-2.1214 ,-1.4637,-3.4110,-2.0793]; b =[0.1527,0.3555,0.4291,0.1678,0.3078]; r =[-0.0963,-0.3700,-0.0963,-0.2179,-0.3438]; J=[(a^2)*j3+(b^2)*j1-a*b*r]/[(a^2)+(b^2)]; W=a*[(b^2)*j3-(b^2)*j1+a*b*r]/[b*(a^2)+(b^2)] 我也没多少分 希望能帮我看看后面的两个问题出在哪里?分段运行主要是J和W不对.
matlab计算时出现“ Error using ==> mpower Inputs must be a scalar and a square matrix.”a =[ -0.0881,-2.1214 ,-1.4637,-3.4110,-2.0793]; b =[0.1527,0.3555,0.4291,0.1678,0.3078]; r =[-0.0963,-0.3700,-0.0963,-0.2179,-0.3438]; J=[(a^2)*j3+(b^2)*j1
首先,你的j1和j3没有赋值.我任意给了一个值,j1=1;j3=3.
其次,你的a、b和r的赋值中逗号要用英文而非中文,我做了修改.a =[-0.0881,-2.1214,-1.4637,-3.4110,-2.0793]; b =[0.1527,0.3555,0.4291,0.1678,0.3078]; r =[-0.0963,-0.3700,-0.0963,-0.2179,-0.3438];
再次(关键问题),矩阵乘积或乘幂,如果要求的是对应元素的乘积,需要用点乘,即在称号或乘幂符号前加一个点.
程序如下:
a =[-0.0881,-2.1214,-1.4637,-3.4110,-2.0793];
b =[0.1527,0.3555,0.4291,0.1678,0.3078];
r =[-0.0963,-0.3700,-0.0963,-0.2179,-0.3438];
j1=1;j3=3;
J=[(a.^2)*j3+(b.^2)*j1-a.*b.*r]./[(a.^2)+(b.^2)]
W=a.*[(b.^2)*j3-(b.^2)*j1+a.*b.*r]./[b.*(a.^2)+(b.^2)]