0

I noticed a confused computation of complex valued multiplication in Matlab. One simple example is as below:

syms x1 x2 x3 x4 s=[x1 x2]*[x3 x4]' 

And the return value of s is like:

s=x1*conj(x3) + x2*conj(x4) 

In my opinion s should be equal to x1*x3+x2*x4. So, what's the problem here?

Then, how should I do if I want to get a multiplication of two complex vector?

update: I find out it will be solved through using .' rather than . like:

s=[x1 x2]*[x3 x4] 

3 Answers 3

4

The operator ' is the also called Complex conjugate transpose in Matlab ctranspose, which basically means that it applies conj and and transpose functions. Note that this operator is call Hermitian operator in mathematics.

What you actually want is the operator transpose that is shortcut as .'

In order to get the expected output, and given that you just want to multiply without conjugating the second vector, you should do:

>> syms x1 x2 x3 x4 >> s = [x1 x2]*[x3 x4].' 

so your output will be:

x1*x3 + x2*x4 

For further information you can check help ., to see the list of operators, help transpose and help ctranspose

Sign up to request clarification or add additional context in comments.

2 Comments

Also known as the Hermitian operator in mathematics. It's common to hear someone say "v Hermitian" in place of "v transposed" for some array v, and it is usually denoted by a cross/dagger symbol to distinguish it from basic transposition. I think Matlab's syntax (using ' for both types of transposition) is a bit confusing if you are new to it and come from a math background.
Thanks for the addition! I edited, commenting that ' works as the Hermitian operator.
2

Note that the ' operator in Matlab is the conjugate transpose, i.e. it both transposes a matrix and takes the complex conjugate:

>> (1+1i)' ans = 1.0000 - 1.0000i 

If you want the matrix transpose then you should use the .' operator:

>> (1+1i).' ans = 1.0000 + 1.0000i 

2 Comments

+1 for teaching me about .' being the equivalent of transpose.
Yes, you are right and thanks a lot for your warm hearted answer.
1

Maybe this will help explain:

>> syms x1 x2 x3 x4 >> s=[x1 x2]*[x3 x4]' s = x1*conj(x3) + x2*conj(x4) >> s=[x1 x2]*[x3; x4] s = x1*x3 + x2*x4 >> [x3 x4]' ans = conj(x3) conj(x4) 

The ' version of transpose isn't doing what you want. Use transpose instead:

>> transpose([x3 x4]) ans = x3 x4 

1 Comment

As @ChrisTaylor points out, .' operator does the same thing as the transpose function.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.