File Exchange

image thumbnail

M-QAM modulation and demodulation

version (398 KB) by Santosh Shah
this is the QAM modulation and demodulation tech. with speech example


Updated 27 Apr 2007

No License

you can rum these files by my_speech.m file, taking an value like my_speech(64, 'qam') in the command window of MATLAB.

Cite As

Santosh Shah (2021). M-QAM modulation and demodulation (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (25)

Dang Nguyen


function z = my_qamdemod(y, m)

%this is the function for demodulation of QAM, y is the M-QAM Modulated
%signam, m is playing the same role. z is the demodulated output. input y
%is a row or coulmn vector and, z should be the row vector.

%santosh shah, The LNM IIT Jaipur (India)( 23/04/07

% again i need to check the value of M, so by the same process.
if log2(sqrt(m))~= floor(log2(sqrt(m)))
error('Please check the value of m that you have provided for type M-QAM.');

%taking the reverse process
k = sqrt(m);
r = 2*(0:k-1) - k + 1;
[xi, yi] = meshgrid(r);
c = xi + j*flipud(yi);
c = c(:);

%now comparing the data from c's vector after rounding the input data.
% Allocate space for output
z = zeros(size(y));

% Slicer: Find closest constellation symbol, symbol-by-symbol.
for k = 1:length(y)
[nil ind] = min(abs(y(k) - c));
z(k) = ind - 1;

Eugene Rychkov

Please, chack code in conditions of multipath channel. When I added it, qnd tried just on saw signal (QPSK = ' statements = 1 2 3 0), i didn't receive 3 in any conditions. Otherwise, when I tried it with waw file, there so much 3 appeared, but in initial massage there are so little 3 number. What is that?

Le Quy Duong

shervin shokri

Dear Santosh Shah
just like some friends i followed your description to run the code but it doesn't work.
how i can fix it?
all the best.

Error using wavread (line 67)
Invalid Wave File. Reason: Cannot open file.

Error in my_speech (line 17)
siz = wavread(test_data, 'size');

alejandro serrano

is good



Sourav Mondal

this code is not working on command window.. even in R2011b version.
In addition, the quam modulator doesn't work for M=2,8,32 i.e., for odd powers of 2..!! Really needs some correction!

Otto Garcia

Hi friend!
I tried with my own file sound but it doesn't work
What do I do?


Hi, Santosh Shah
I use MATLAB 2009, I have tried to run your code but it doesn't work. In command window show this message.

>> my_speech(64,'qam')
??? Error using ==> wavread at 67
Cannot open file.

Error in ==> my_speech at 17
siz = wavread(test_data, 'size');

How can I fix it?
Best regard,

lijian zhang

very good

nikos mpairak

thanks a lot


zhao long

very good ,gold bless you

Nabil al-hadawy


Luisa Fernanda Echevery

Me parece excelente el archivo

Ruben Bocos

WU Chia -da

snell marc

Rami Neseem

Nguyen Duc Phu

I am working for Vietnam television
I need QAM Modulation software

My speech_sim_result.bmp Tenqchen

Good fitting

Adomniteimiki Mihaela


simo azzed

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!