2013-10-23 23 views
0

我在八度音程两个列向量:在八度乘以2个columnvectors

a=[1;2;3;4;5;6;7] 

b=[7;6;5;4;3;2;1] 

我想乘这两个向量:

A * B和A * B”既给了错误:

error: operator *: nonconformant arguments (op1 is 7x1, op2 is 7x1) 

我做错了什么?

+1

尝试*(B')...... – apomene

+0

尝试重新启动八度,'一* b''应该工作。你正在运行什么版本? – Dan

回答

0

a*b不起作用,因为您无法将7x1向量乘以7x1向量。正如在评论中提到的那样,a*b'的作品(因为现在你乘以1x7矢量的7x1矢量,导致7x7矩阵),因此a.*b(单元乘法)。下面是我得到倍频3.6.2:

>> a*b 
error: operator *: nonconformant arguments (op1 is 7x1, op2 is 7x1) 
>> a*b' 
ans = 

    7 6 5 4 3 2 1 
    14 12 10 8 6 4 2 
    21 18 15 12 9 6 3 
    28 24 20 16 12 8 4 
    35 30 25 20 15 10 5 
    42 36 30 24 18 12 6 
    49 42 35 28 21 14 7 

>> a.*b 
ans = 

    7 
    12 
    15 
    16 
    15 
    12 
    7