Matrix dimensions must agree

[EDIT: 20110606 10:32 CDT - reformat - WDR]
??? Error using ==> times Matrix dimensions must agree. Error in ==> prop_marcuse at 49
ep = exp(-a*dz/2)*ifft((exp(-i*dz*d/2)).*fip);
Error in ==> lt_amprett at 93
E = prop_marcuse(E,ac,b2,b3,ass,n2,Aeff,k0,dz,dt);
??? Error while evaluating uico
hi guys, i'm new in matlab central so hello to everyone. i've a problem in my program. the program it's about propagation in an optical fiber of a signal qpsk modulated. I can't post the functions here because it would be too long. if someone wants to help please contact me and i will give him all the program folder. i'm so close to the solution but i can't understand where i've to correct something. i think it's right but it doesn't seem. i hope someone will answer me. thanks everybody.

답변 (2개)

Matt Fig
Matt Fig 2011년 6월 6일

0 개 추천

Use .* instead of * when you desire element-by-element multiplication. For example,
x = 1:3
y = 4:6
x.*y

댓글 수: 2

Marco
Marco 2011년 6월 6일
i think i've done correct.when i have an fft i've tu put the ".*" and when i have ifft i can use "*".right?
Matt Fig
Matt Fig 2011년 6월 6일
When needing to multiply (or divide or exponentiate) arrays element-by-element, you always should use .* and ./ and .^.

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

Walter Roberson
Walter Roberson 2011년 6월 6일

0 개 추천

You probably need
ep = exp(-a.*dz/2).*ifft((exp(-i.*dz.*d/2)).*fip);
In particular I suspect the dot missing between the exp() term and the ifft() term is the key.

댓글 수: 4

Marco
Marco 2011년 6월 6일
which exp?the first or the second?
Marco
Marco 2011년 6월 6일
i put the dot but it doesn't change anything.
Walter Roberson
Walter Roberson 2011년 6월 6일
The first. But using extra usually does not hurt. Unless you know you are wanting to use matrix multiplication (in a mathematical sense) then you should probably use .*
Walter Roberson
Walter Roberson 2011년 6월 6일
Ah... what is the size of fip, and what is the size of dz and of d ?

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

카테고리

도움말 센터File Exchange에서 Communications Toolbox에 대해 자세히 알아보기

질문:

2011년 6월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by