Wrong matrix multiplication answer
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Joao
am 12 Okt. 2014
Beantwortet: Image Analyst
am 12 Okt. 2014
Hi,
This multiplication gets a wrong answer:
E=[Eopt(1) 0];
coupler=[sqrt(0.9) 1i*sqrt(0.1);1i*sqrt(0.1) sqrt(0.9)];
Eout=coupler*E(1);
The answer:
Eout =
9.4868 + 0.0000i -0.0000 + 3.1623i
-0.0000 + 3.1623i 9.4868 + 0.0000i
I am multiplying a 2x2 with a 2x1 matrix, so the result should be a 2x1 matrix.
Why is that?
Thanks
0 Kommentare
Akzeptierte Antwort
Guillaume
am 12 Okt. 2014
No, you are multiplying a 2x2 matrix with a scalar, the first element of E.
Did you mean?
Eout = coupler * E;
0 Kommentare
Weitere Antworten (1)
Image Analyst
am 12 Okt. 2014
E(1) is a scalar = just a single number. Try this:
Eopt = 3 % Whatever....
E=[Eopt(1) 0]
coupler=[sqrt(0.9) 1i*sqrt(0.1);1i*sqrt(0.1) sqrt(0.9)]
Eout= E * coupler % E is now a matrix and on the left.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!