Quadrature amplitude demodulation
z = qamdemod(y,M)
z = qamdemod(y,M,ini_phase)
z = qamdemod(y,M,ini_phase,symbol_order)
z = qamdemod(y,M) demodulates the complex envelope y of a quadrature amplitude modulated signal. M is the alphabet size and must be an integer power of 2. The constellation is the same as in qammod. If y is a matrix with multiple rows, the function processes the columns independently.
z = qamdemod(y,M,ini_phase,symbol_order) specifies how the function assigns binary words to corresponding integers. If symbol_order is set to 'bin' (default), the function uses a natural binary-coded ordering. If symbol_order is set to 'gray', it uses a Gray-coded ordering.
The code below suggests which regions in the complex plane are associated with different digits that can form the output of the demodulator. The code demodulates random points, looks for points that were demapped to the digits 0 and 3, and plots those points in red and blue, respectively. Notice that the regions reflect a rotation of the signal constellation by pi/8.
% Construct [in-phase, quadrature] for random points. y = 4*(rand(1000,1)-1/2)+j*4*(rand(1000,1)-1/2); % Demodulate using an initial phase of pi/8. z = qamdemod(y,4,pi/8); % Find indices of points that mapped to the digits 0 and 3. red = find(z==0); blue = find(z==3); % Plot points corresponding to 0 and 3. h = scatterplot(y(red,:),1,0,'r.'); hold on scatterplot(y(blue,:),1,0,'b.',h); legend('Points corresponding to 0','Points corresponding to 3'); hold off
Another example using this function is in Compute the Symbol Error Rate.