forked from ganlubbq/amclab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
amcml.m
31 lines (26 loc) · 1.28 KB
/
amcml.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function [modulationDecision, likelihood]= amcml(sigIn,modulationPool,channelParameter)
%%AMCML Classifies the modulation type of the input signal using maximum
%%likelihood classifier
%
% result = amcml(sigIn,modulationPool,channelParameter) classifies the
% modulation type of sigIn from a pool of modulation canddiates defined
% by modulation pool. The channel state information channelParameter is
% needed to complete the classification.
%
% Copyright (C) 2013 Zhechen Zhu
% This file is part of Zhechen Zhu's AMC toolbox 0.3
%
% Update (version no.): modification (editor)
for iModulationCandidate = 1:numel(modulationPool)
% Select modulation candidate
modulationCandidate = modulationPool{iModulationCandidate};
% Generated alphabet set/symbols for the modulation candidate
symbol = getalphabet(modulationCandidate);
% Calculate the noise variance from SNR
sigma = sqrt(10^(-channelParameter(1)/10))/sqrt(2);
% Evaluate the likelihood using AWGN noise model
likelihood(iModulationCandidate) = likelihoodfunction(sigIn,symbol,sigma);
end
% Find the modulation candidate that provides the highest likelihood
[Y,iModulationDecision] = max(likelihood);
modulationDecision = modulationPool{iModulationDecision};