Sina
Sina

Reputation: 183

multiplying real part of a complex number while imaginary part stay tact (Matlab)

I am trying to multiply real part of a complex number to a scalar while the imaginary part stay the same.

For example x= a + bi after multiplying to c result us y= ca + bi.

Any suggestions on procedure?

Upvotes: 1

Views: 1217

Answers (1)

EJG89
EJG89

Reputation: 1189

For this you can use the real and imag functions in MatLab. So the multiplication becomes:

y = real(x) * c + imag(x)*i

real(see documentation) retrieves a from x and imag(see documentation) retrieves b from x. Don't forget to multiply with i again ;)

Upvotes: 3

Related Questions