mtimes - Inner matrix dimensions must agree
>> k=0:0.01:1;>> t=(3337-2250*k)/50*(2213-1400*k)
??? Error using ==> mtimes
Inner matrix dimensions must agree.
[ 本帖最后由 ChaChing 于 2009-7-12 18:07 编辑 ] LZ一定知道有点乘(.*)这一说吧,出错原因就是因为点乘!
t=(3337-2250*k)/50.*(2213-1400*k);
??? Error using ==> mtimes
一般出现这个错误都是由于没有用点乘,所以在用矩阵相乘时一定要注意!
回复 沙发 ch_j1985 的帖子
谢谢!还有一个问题,为什么只有一个地方要加点,如果
t=(3337-2250*k)/2213-1400*k);
的话应该把点加在哪里呢?
问题解决了,谢谢!
[ 本帖最后由 ChaChing 于 2009-12-17 21:46 编辑 ] 原帖由 blueheart44 于 2009-7-12 09:44 发表 http://www.chinavib.com/forum/images/common/back.gif
谢谢!
还有一个问题,为什么只有一个地方要加点,如果
t=(3337-2250*k)/2213-1400*k);
的话应该把点加在哪里呢?
t1=(3337-2250*k)./(2213-1400*k);
t2=(3337-2250*k).\(2213-1400*k);
t3=(3337-2250*k)\(2213-1400*k);
t4=(3337-2250*k)/(2213-1400*k);
这四个都可以运行出结果,但是结果不同!原因我也说不清楚……:@Q
数和矩阵相乘是可以不用点乘的
个人观点,仅供参考!
回复 5楼 ch_j1985 的帖子
\Matrix left division. A\B solves the symbolic linear equations A*X=B for X. Note that A\B is roughly equivalent to inv(A)*B. Warning messages are produced if X does not exist or is not unique. Rectangular matrices A are allowed, but the equations must be consistent; a least squares solution is not computed.
.\
Array left division. A.\B is the matrix with entries B(i,j)/A(i,j). A and B must have the same dimensions, unless one is scalar.
/
Matrix right division. B/A solves the symbolic linear equation X*A=B for X. Note that B/A is the same as (A.'\B.').'. Warning messages are produced if X does not exist or is not unique. Rectangular matrices A are allowed, but the equations must be consistent; a least squares solution is not computed.
./
Array right division. A./B is the matrix with entries A(i,j)/B(i,j). A and B must have the same dimensions, unless one is scalar.
页:
[1]