필터 지우기
필터 지우기

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