imaginary number

5 views (last 30 days)
katerina jablonski
katerina jablonski on 5 Jun 2012
okay this should be simple, but it's not working. i'm just trying to assign a name to the imaginary part of Sload, but i'm getting an error message.
here's the script:
Sload = VldRect*(conj(IC1Rect+IC2Rect+IindRect))*.5
Pload = real(Sload)
Qload = imag(Sload)
here's the output:
Sload =
0.0170 + 0.0003i
Pload =
0.0170
??? Subscript indices must either be real positive integers or logicals. Error in ==> Matlab_project_2_newest at 175
Qload = imag(Sload)

Answers (2)

Walter Roberson
Walter Roberson on 5 Jun 2012
In your earlier Question, you defined "real" and "imag" as variables in your script, overriding their use as functions. Until you
clear real imag
or restart MATLAB, your scripts are going to continue to find those as being variables.

katerina jablonski
katerina jablonski on 5 Jun 2012
oh man. you are great. thanks!

Community Treasure Hunt

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

Start Hunting!