How to expand fully with complex numbers?

Hello all,
Might be a rookie question but I am wondering how to do FOIL multiplication with complex numbers. This far I've managed to get something displaying a polynomial As^4 + Bs^3 + Cs^2 + ... , however all coefficients are complex numbers and I would like the imaginary components of these to cancel out as they do when performing this by hand.
Even a point in the right direction would be appreciated!

 Respuesta aceptada

madhan ravi
madhan ravi el 12 de Oct. de 2018
Editada: madhan ravi el 12 de Oct. de 2018
clear all %an example
syms x
polynomial=i*x-x.^2 %i indicates imaginary number
a = coeffs(polynomial)
real(a)

2 comentarios

Marissa van Wyngaardt
Marissa van Wyngaardt el 13 de Oct. de 2018
Worked like a charm, thank you so much!
madhan ravi
madhan ravi el 13 de Oct. de 2018
you're welcome :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Preguntada:

el 12 de Oct. de 2018

Comentada:

el 13 de Oct. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by