Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: symbolic variables and complex numbers
Replies: 9   Last Post: Jun 14, 2013 9:16 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Alan Weiss

Posts: 1,256
Registered: 11/27/08
Re: symbolic variables and complex numbers
Posted: Jun 14, 2013 8:56 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 6/14/2013 5:17 AM, Uwe Brauer wrote:
> "Torsten" wrote in message <kpeljp$i6p$1@newscl01ah.mathworks.com>...
>

>> > Uwe Brauer
>> imag(sin(phi)) = 0, so the result should be abs(cos(phi)).
>> You should get this result using
>> simplify(abs(cos(phi)-1/2*i*sin(phi)+1/2*i*sin(abs(phi)^2/phi))).
>> Maybe you meant z=cos(phi)+i*sin(phi) ?
>>
>> Best wishes
>> Torsten.

>
> well I meant z=cos(phi)+i*sin(phi)
> However then Matlab returns only abs(cos(phi)+i*sin(phi))
> which is not helpful.
>
> That is why I thought Imag means i*sin(phi), but no (I did not check
> carefully enough the doc): for a given complex number imag returns the
> imaginary part.
> But back to my original question it seems that matlab cannot calculate
> the absolute value of a complex function symbolically.


There are two problems. The main one is that you did not assume that phi
was real. If phi is complex, then abs(cos(phi) + i*sin(phi)) is not one.

Try the following:

syms phi real
z = abs(cos(phi) + i*sin(phi))
y = simplify(z,'Steps',100)

I get the following result:

y =

1

Alan Weiss
MATLAB mathematical toolbox documentation



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.