Azzera filtri
Azzera filtri

Wrong distribution of vectors using discretize

2 visualizzazioni (ultimi 30 giorni)
Ashbub
Ashbub il 15 Apr 2018
Commentato: the cyclist il 16 Apr 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 Commenti
Ashbub
Ashbub il 16 Apr 2018
Modificato: Ashbub il 16 Apr 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.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by