Thanks for your response. symbol_book is 1x4 matrix which has the QPSK reference quadrants {0.7071+0.7071i, -0.7071+0.7071i, -0.7071-0.7071i, 0.7071-0.7071i}. Now, the x_hat is the estimated data with 50000x1 matrix. What i am trying to do is find the min distance between the QPSK reference and the actual received data. Not sure if maybe when i switched to 2015 matlab would have an effect! please advise
I get an error in knnsearch
3 次查看(过去 30 天)
显示 更早的评论
rec_syms = knnsearch([real(symbol_book) imag(symbol_book)], [real(X_hat) imag(X_hat)]) - 1;
I get this error:
Error using KDTreeSearcher/knnsearch (line 74)
Y must be a matrix with 8 columns.
Error in knnsearch (line 142)
idx = knnsearch(O,Y,'k',numNN, 'includeties', includeTies);
Error in OFDM_image (line 139)
rec_syms = knnsearch([real(symbol_book) imag(symbol_book)], [real(X_hat) imag(X_hat)]) - 1;
采纳的回答
Walter Roberson
2015-12-5
[real(symbol_book) imag(symbol_book)] together makes a matrix with 8 columns, such as if there are 4 columns in symbol_book. But [real(X_hat) imag(X_hat)], the locations to search for, does not have 8 columns. The locations to search for (the second parameter) must have the same number of columns as the first parameter.
3 个评论
Walter Roberson
2015-12-6
You had a row vector of 4 elements. real() of that is something that is 1 x 4. imag() of it was also 1 x 4. []'ing those together resulted in something 1 x 8. Your set of points to be searched through was therefore a single point with 8 dimensions. But that is not what you wanted: you wanted 4 points with two dimensions. Using symbol_book(:) reshapes from 1 x 4 to be 4 x 1. Use [] to put two 4 x 1 together and you get 4 x 2 -- 4 points each with 2 dimensions.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classification Ensembles 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!