"Sandra " <smh31.nospam@sussex.ac.uk> wrote in message
<g69nj3$9he$1@fred.mathworks.com>...
> I am sure this must be a simple thing, but it is doing my
> head in!!! imag and real don't work for me see below:
>
> >> real(0.0116 + 0.3333i)
> ??? Subscript indices must either be real positive integers
> or logicals.
>
> >> real(2+3*i)
> ??? Subscript indices must either be real positive integers
> or logicals.
>
> >> imag(2+3*i)
> ??? Subscript indices must either be real positive integers
> or logicals.
>
>
> the last two are from the matlab example! what am I doing
wrong?
Check that you haven't assigned anything to i. i and j
should be reserved for complex numbers. type 'clear i' in
command window and then try again.
dave
"Sandra " <smh31.nospam@sussex.ac.uk> wrote in message
<g69nj3$9he$1@fred.mathworks.com>...
> I am sure this must be a simple thing, but it is doing my
> head in!!! imag and real don't work for me see below:
>
> >> real(0.0116 + 0.3333i)
> ??? Subscript indices must either be real positive integers
> or logicals.
>
> >> real(2+3*i)
> ??? Subscript indices must either be real positive integers
> or logicals.
>
> >> imag(2+3*i)
> ??? Subscript indices must either be real positive integers
> or logicals.
>
>
> the last two are from the matlab example! what am I doing wrong?
>
> any advice appreciated,
> sandra
Every single new user does this. They create
a variable with the name of a function they
will later use.
Have you created variables named imag and
real? What should Matlab do when it sees
variables with that name, but you try to use
the functions of the same names?
Just for kicks, now create variables named
quit and exit, as well as clear. Make your life
interesting. ;-)
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.