0
$\begingroup$

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!

  • 3
    What *exactly* are you entering? The formula for rotating $(x,y)$ to $(x',y')$ is correct, but I don't know how you are relating it to $a+bi$, and we can't tell what your mistake is unless you tell us exactly what you are doing.2017-01-06
  • 0
    The data is in the form (a,b) and that's how it's plotted2017-01-06
  • 1
    Where do you derive the rotation angle from? What is $θ$ in relation to the given data?2017-01-06
  • 0
    @boson Ok, that answers my second question, but there is still a lot left to explain about what exactly you're doing to plot it.2017-01-06
  • 1
    Show us your code and we'll spot the bug. My bet is premature assignment of $x$.2017-01-06

1 Answers 1

0

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).