can't multiply matrices

Hi, I'm trying to multiply two matrices - a two by two and two by one - and it gives me the error message - ??? Array dimensions must match for binary array op. I can't see why this is not allowed?
Here's my code: -
S = 0.000043;
l = 0.03;
f = (linspace(20,14840,14821))';
c = 345;
ABCD(1,1,:) = cos((l/c)*2*pi*f);
ABCD(1,2,:) = 1i*(415/S)*sin((l/c)*2*pi*f);
ABCD(2,1,:) = 1i/(415/S)*sin((l/c)*2*pi*f);
ABCD(2,2,:) = cos((l/c)*2*pi*f);
p_AT = ones(length(f),1);
u_AT = 3*10^-15;
U_AT = (ones(length(f),1))*(u_AT/S);
Z_AT(1,1,:) = p_AT;
Z_AT(2,1,:) = U_AT;
Z_A0 = ABCD.*Z_AT;

 採用された回答

José-Luis
José-Luis 2013 年 1 月 13 日

0 投票

Please try to use the debugger. It is generally more efficient than to have us debug your code remotely and might save you a lot of time in the future. In this case it is not working because ABCD and Z_AT don't have the same size and you are attempting element by element multiplication of their values.

1 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 1 月 13 日
編集済み: Azzi Abdelmalek 2013 年 1 月 13 日
ABCD size is 2x2x14821
Z_AT size is 2x1x14821 its not the same size as ABCD

サインインしてコメントする。

その他の回答 (1 件)

Jam
Jam 2013 年 1 月 13 日

0 投票

okay thanks. i found a solution from another post here so i'm okay now - http://www.mathworks.co.uk/matlabcentral/newsreader/view_thread/158244

1 件のコメント

José-Luis
José-Luis 2013 年 1 月 13 日
Please accept an answer if it helped you, even if it is your own and solves the problem.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

製品

質問済み:

Jam
2013 年 1 月 13 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by