real part of a complex number
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161394/image.png)
0 Kommentare
Antworten (1)
Stephen23
am 6 Mär. 2017
Bearbeitet: Stephen23
am 6 Mär. 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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!