Trying to convert cartesian coordinates to polar coordinates

So when I use cart2pol(x,y) I am getting some random values on my plots that do not line up and are incorrect. I dont have a real good way of describing it but I know its wrong and has to do with my origins cooridnate frame and how I defined it but you can see with pictures what I am talking about.
The first photo is where my data is coming from, a double pendulum with the origin being the center where the pendulum rotates. It has full range of motion 360°. The point masses can and will pass over the x axis (this is where the negatives get to be a problem) If I plot this data take straight from my program(figure1) and use [theta,rho] = cart2pol(x,y) to convert my coordinates to polar my plot looks like this (figure 2). I am concerned about the random dips with the small valleys like mass B at about 1 second and mass A at 4 seconds. Are those dips normal, are the plots correct? Are my cooridnates that are being translated wrong? I dont know but I sure hope you do so please help....

Answers (1)

I am concerned about the random dips with the small valleys like mass B at about 1 second and mass A at 4 seconds. Are those dips normal, are the plots correct?
The plots appear to be correct.
See if using the unwrap function will eliminate the apparent discontinuities.
.

Categories

Find more on General Applications in Help Center and File Exchange

Products

Release

R2020b

Asked:

on 30 Sep 2021

Answered:

on 30 Sep 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!