Vector loop angle and direction

6 次查看(过去 30 天)
Izan Segarra
Izan Segarra 2022-1-6
回答: arushi 2023-12-29
I am working with a 2D array that forms an XY loop and I am trying to get the dominant angle and direction of the loop. I have used principal component analysis (PCA) and obtained the maximum norm of each pair of points but it is not a robust method.... It works correctly for a loop as seen in the first image (fig1.png), however, the second image (fig2.png) should give a similar result and it is detected backwards. Is there any methodology or algorithm that provides a good result?
  4 个评论
Mathieu NOE
Mathieu NOE 2022-1-8
seems the side where the arrow should point to is always the "smooth" side that ressemble to a half elipse
am I wrong ?
maybe we could discriminate the quadrant based on data smoothness or a R² coefficient if we wanted to fit a parabola
Izan Segarra
Izan Segarra 2022-1-11
编辑:Izan Segarra 2022-1-11
Sometimes, the direction is marked by abrupt data... ( As you can see in the image below) I think that it's necesary to combine different methods to detect the direction correctly.

请先登录,再进行评论。

回答(1 个)

arushi
arushi 2023-12-29
Hi Izan,
I understand that you want to know a different method for finding the direction and angle other than PCA. Principal Component Analysis (PCA) is a statistical method that can be used to determine the principal directions of a dataset. However, PCA itself does not provide information about the orientation or directionality of a loop; it only gives the axes of maximum variance. When dealing with loops or closed curves, the directionality can be ambiguous, and PCA might not be the best tool to determine the dominant angle and direction of the loop. If you are looking for a consistent way to determine the orientation of a loop, you might consider using methods that are more geometric in nature.
Here are a few methodologies and algorithms that could potentially provide a more robust result for determining the dominant angle and direction of a loop:
Curve Orientation:
  • Calculate the signed area of the loop. A positive or negative area can indicate the direction of traversal (clockwise or counterclockwise).
  • Use the "shoelace formula" to compute the signed area and infer the direction based on the sign.
  • Documentation for the same - https://en.wikipedia.org/wiki/Curve_orientation
Curve Fitting:
  • Fit an ellipse to the data points using methods like the Direct Least Square Fitting of Ellipses. The orientation of the ellipse can give you the dominant angle.
  • The direction of the loop can be inferred by tracking the sequential order of points along the fitted ellipse.
Angular Histogram:
  • Compute the angles between consecutive points (or vectors) along the loop and create a histogram.
  • The peak of the histogram can indicate the dominant angle, and the sequence of angles can give directionality.
Traveling Direction:
  • If the loop represents a trajectory, you may be able to use the time series data or index ordering to determine the traveling direction.
When implementing these methods, it's important to consider the possibility of noise and outliers in your data, as they can significantly affect the results. Preprocessing steps such as smoothing or filtering might be necessary to obtain a clearer signal of the loop's orientation and direction.
Hope this helps.
Thank you

类别

Help CenterFile Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by