- https://www.mathworks.com/help/comm/ref/qamdemod.html
- https://www.mathworks.com/help/comm/ref/qammod.html
group delay how to add it?
4 views (last 30 days)
Show older comments
clc;
clear all;
M=32;
x=RANDINT(100e3,1,M);
y=modulate(modem.qammod(M),x);
ynoisy=awgn(y,27,'measured');
%%I think here we should have group delay??
scatterplot(ynoisy),grid;
z=demodulate(modem.qamdemod(M),ynoisy);
figure (2);
subplot(2,1,1);
stem(x(1:10),'filled'),grid;title('transmitted data')
subplot(2,1,2);
stem(z(1:10),'filled'),grid;title('received data');
[num ty]=symerr(x,z);
I want to add Group delay to QAM and show the effect of group delay Also I know there is function for this job but how to use it! http://www.mathworks.com/help/toolbox/signal/grpdelay.html
0 Comments
Answers (1)
Vidhi Agarwal
on 2 Aug 2024
Hi Ali,
To add group delay using the “grpdelay” function in MATLAB, you need to design a filter that introduces the desired group delay and then apply this filter to your signal. Below is modified code for the same:
clc;
clear all;
% Parameters
M = 32;
numSymbols = 100e3;
SNR = 27; % Signal-to-noise ratio in dB
groupDelay = 5; % Desired group delay in samples
% Generate random data
x = randi([0 M-1], numSymbols, 1);
% Modulate the data using QAM
y = qammod(x, M);
% Add AWGN noise
ynoisy = awgn(y, SNR, 'measured');
% Design an FIR filter to introduce the desired group delay
b = fir1(2*groupDelay, 0.5); % Low-pass filter with order 2*groupDelay
h = dfilt.dffir(b);
% Apply the filter to introduce group delay
yDelayed = filter(h, [ynoisy; zeros(groupDelay, 1)]);
yDelayed = yDelayed(groupDelay+1:end); % Remove the initial transient
% Scatter plot of noisy signal with group delay
scatterplot(yDelayed), grid on;
title('Noisy QAM Signal with Group Delay');
% Demodulate the delayed signal
z = qamdemod(yDelayed, M);
% Plot transmitted vs. received data
figure(2);
subplot(2,1,1);
stem(x(1:10), 'filled'), grid on;
title('Transmitted Data');
subplot(2,1,2);
stem(z(1:10), 'filled'), grid on;
title('Received Data');
% Calculate symbol error rate
[num, ty] = symerr(x, z);
disp(['Number of symbol errors: ', num2str(num)]);
disp(['Symbol error rate: ', num2str(ty)]);
For detailed information on “qammod” and “qamdemod” refer to the following documentation:
Hope that Helps!
0 Comments
See Also
Categories
Find more on QAM in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!