Effacer les filtres
Effacer les filtres

Wrong distribution of vectors using discretize

1 vue (au cours des 30 derniers jours)
Ashbub
Ashbub le 15 Avr 2018
Commenté : the cyclist le 16 Avr 2018
HI
I am using Discretize function to distribute vectors with their mirrors in 24 bins of each 15 degree. But the distribution of them gives wrong placement of data at around 45, 135, 225 and 315 degrees. The data which are exactly equal to the edges 45, 315, 225 and 315 gives the wrong result. I have tried 'IncludedEdge','right' or 'left'. Nothing works.
The following data shows the number of vectors and their mirrors are similar except, in the bins of (30-45, 45-60; 120-135, 135-150; 210-225, 225-240; 300-315 , 315-330).
(0-180): 11 4 9 7 17 6 31 5 2 9 5 7 (181-360): 11 4 7 9 17 6 31 5 1 10 5 7
Does anyone have any idea what's happening here? I badly need to sort this out. Thanks.
  3 commentaires
Ashbub
Ashbub le 16 Avr 2018
Modifié(e) : Ashbub le 16 Avr 2018
Sorted out the issue just now. It was due to mismatch of floating point truncation. In the expression Y = discretize(X,edges), calculated values of X and edges were showing different truncation places. Rounding them both to similar truncation places solved the issue. It was really painful experience until the caused was identified. Anyways, Thankyou.
the cyclist
the cyclist le 16 Avr 2018
Glad you figured it out!

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by