File Exchange

image thumbnail

M-QAM modulation and demodulation

version 1.0 (398 KB) by

this is the QAM modulation and demodulation tech. with speech example

13 Ratings



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.

Comments and Ratings (24)


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;

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

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');

is good



Rashed (view profile)

Sourav Mondal

Sourav Mondal (view profile)

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

thanks a lot


alaa (view profile)

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
MATLAB 7.4 (R2007a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video