📄 closest.m
字号:
%+----------------------------------------------------------------+
%| |
%| Name: closest.m |
%| Author: Mathew Liu, James Shen |
%| Description: Takes in a QAM alphabet and a noisy_symbol and |
%| finds the closest match on the constellation. It also returns |
%| the index of it inside the QAM alphabet array. |
%| |
%+----------------------------------------------------------------+
function[out_symbol, index] = closest(QAM_alpha, noise_symbol)
for i=1:length(QAM_alpha)
dist(i) = abs(QAM_alpha(i) - noise_symbol);
end
[val,index] = min(dist);
out_symbol = QAM_alpha(index);
%====================== End File =================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -