作业帮 > 综合 > 作业

matlab中 Error using ==> mtimes Inner matrix dimensions must

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/06/23 03:20:48
matlab中 Error using ==> mtimes Inner matrix dimensions must agree.
程序A=[3 8 5 1 2];
B=[3 4 5 2 6];
>> i=1:length(A);
>> i=1:length(B);
>> sum=sum(A(i)+A(i)*B(i))
Error using ==> mtimes
Inner matrix dimensions must agree.
matlab中 Error using ==> mtimes Inner matrix dimensions must
要点乘,而且逻辑上i不应该两次赋值
A=[3 8 5 1 2];
B=[3 4 5 2 6];
i=1:length(A);
j=1:length(B);
sum=sum(A(i)+A(i).*B(j))
再问: A=[3 8 5 1 2]; B=[3 4 5 2 6]; i=1:length(A); j=1:length(B); sum=sum(A(i)+A(i).*B(j)) ??? Index exceeds matrix dimensions. 出现这种情况喔。还有如果要在matlab中敲累加的函数式该怎么敲啊? y=∑Xi+Xi*Yi(i从1到5)是怎么回事啊?
再答: y=sum(A+A.*B)