フィルターのクリア

Wrong distribution of vectors using discretize

2 ビュー (過去 30 日間)
Ashbub
Ashbub 2018 年 4 月 15 日
コメント済み: the cyclist 2018 年 4 月 16 日
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.
the cyclist
the cyclist 2018 年 4 月 16 日
Glad you figured it out!

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by