Wrong distribution of vectors using discretize

1 次查看(过去 30 天)
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 个评论
Ashbub
Ashbub 2018-4-16
编辑:Ashbub 2018-4-16
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by