Why is my rotation not working?

65 Views Asked by At

I have complex data (a+bi) and when I plot without rotating I get Unrotated

But when I try to rotate using $x' = x*cos(\theta) - y*sin(\theta)$ and $y' = y*cos(\theta) + x*sin(\theta)$

I get this Rotated

Any help would be greatly appreciated!

1

There are 1 best solutions below

0
On BEST ANSWER

If your data are for a curve in polar coordinates, $$a(t)+ib(t)=r(t)e^{iθ(t)},$$ then you probably want to trace \begin{align} r&=e^{-iθ}(a+ib) \\ &=\bigl(\cos(θ)a+\sin(θ)b\bigr)+i\bigl(\cos(θ)b-\sin(θ)a\bigr). \end{align}

If you compute $θ$ as the argument of $a+ib$, be sure to correct for the right quadrant when using the arcus tangent function, or use the often available argument function theta=atan2(b,a).