why i am getting blank plot

4 ビュー (過去 30 日間)
pooja
pooja 2023 年 9 月 26 日
コメント済み: Dyuman Joshi 2023 年 9 月 26 日
% 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 件のコメント
pooja
pooja 2023 年 9 月 26 日
i was getting 6 plots 3 blank plots , but after removing figure it resolved
Dyuman Joshi
Dyuman Joshi 2023 年 9 月 26 日
How can you have 9 plots when you have only defined 3*2 == 6 plots?

サインインしてコメントする。

採用された回答

Mann Baidi
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 件のコメント
pooja
pooja 2023 年 9 月 26 日
it worked thanks a lot
Dyuman Joshi
Dyuman Joshi 2023 年 9 月 26 日
@pooja, There was no problem with your code to begin with.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModulation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by