Matrix Multiplication

조회 수: 11 (최근 30일)
Eric
Eric 2011년 9월 16일
Basically I have a problem with multiplying my matrices and have No idea howto solve it 1st. Matrix x(t) = sin( 2*pi*t/3) for t = -20:0.01:20 2nd. Matrix N=4000 w=hamming(N)
How do I multiply these two togehter (element by element didnt work when I transposed X and then .*'d it with w)

답변 (2개)

Fangjun Jiang
Fangjun Jiang 2011년 9월 16일
use size() function to get the size of your matrix. You'll find out the size of your two matrices are slightly different.

Eric
Eric 2011년 9월 16일
Thankyou for the quick reply, but the problem is still the same. I found out that x = 4001 1, and w was 1 4000, so I changed N to 4001. Now x: 4001 1, and w = 4001 1. However it still gives me an error with the dimensions
  댓글 수: 2
Fangjun Jiang
Fangjun Jiang 2011년 9월 16일
You need to understand the difference between matrix multiplication and element multiplication. A=rand(3,1);B=rand(3,1);C=A.*B;D=A*B';
Fangjun Jiang
Fangjun Jiang 2011년 9월 16일
In your code, x should be 1 by 4000.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by