Borrar filtros
Borrar filtros

real part of a complex number

1 visualización (últimos 30 días)
JazzMusic
JazzMusic el 6 de Mzo. de 2017
Editada: Stephen23 el 6 de Mzo. de 2017
Hi,
I am trying to get the real part of a complex number and my matlab gives error.
for example: I write:
Z = 2+3*i;
X = real(Z) code
and I get:
Index exceeds matrix dimensions.
Any idea why?

Respuestas (1)

Stephen23
Stephen23 el 6 de Mzo. de 2017
Editada: Stephen23 el 6 de Mzo. de 2017
Because you have assigned the name real to a variable. When you shadow an inbuilt function or variable with your own variable, then that inbuilt function cannot be called.
Solution: clear that variable:
clear real
And do not use variable names length, size, cell, i, j, real, etc.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by