On 6/14/2013 5:17 AM, Uwe Brauer wrote: > "Torsten" wrote in message <email@example.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:
Alan Weiss MATLAB mathematical toolbox documentation