why i am getting blank plot
4 次查看(过去 30 天)
显示 更早的评论
% PAM Modulation
M_pam = [2, 4, 8]; % Order of PAM modulation
for i = 1:length(M_pam)
% Generate random binary data
data = randi([0 M_pam(i)-1], 10, 1);
% PAM modulation
mod_signal = pammod(data, M_pam(i));
% Plot passband waveform
figure;
plot(mod_signal);
title(['Passband PAM Modulation, M = ', num2str(M_pam(i))]);
% Plot signal space representation (I-Q)
figure;
scatterplot(mod_signal, 1, 0, 'b*');
title(['Signal Space Representation (I-Q) for PAM, M = ', num2str(M_pam(i))]);
end
3 个评论
采纳的回答
Mann Baidi
2023-9-26
编辑:Mann Baidi
2023-9-26
Hi Pooja,
I understand you are facing issue in plotting graphs in a loop. I would suggest you to remove the "figure" from the "scatter plot" function. You can try this modified code.
M_pam = [2,4,8]; % Order of PAM modulation
for i = 1:length(M_pam)
% Generate random binary data
data = randi([0 M_pam(i)-1], 10, 1);
% PAM modulation
mod_signal = pammod(data, M_pam(i));
% Plot passband waveform
figure
plot(mod_signal);
title(['Passband PAM Modulation, M = ', num2str(M_pam(i))]);
% Plot signal space representation (I-Q)
scatterplot(mod_signal, 1, 0, 'b*');
title(['Signal Space Representation (I-Q) for PAM, M = ', num2str(M_pam(i))]);
end
Hope this helps!
3 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!