Program:
clc;
clear all;
n = input('Enter the number of values to be compared = ');
colour = ['k','r','g','b','y'];
nsample = 1;
m = 4;
for i = 1:n
eb_db = 0:0.0001:25;
k = log2(m);
es_db = eb_db + 10*log(k) + 10*log(nsample);
es = db2mag(es_db);
p = 4*qfunc(sqrt(3*es/(m-1)));
semilogy(eb_db,p,colour(k));
hold on;
m = m*2;
end
xlabel('SNR ----->');
ylabel('Probability of Error ----->');
title('Error Probability Curve of M ary QAM');
grid on;
legend('m = 4','m = 8','m = 16','m = 32');
Output:
Enter the number of values to be compared = 4
Output Graph:
clc;
clear all;
n = input('Enter the number of values to be compared = ');
colour = ['k','r','g','b','y'];
nsample = 1;
m = 4;
for i = 1:n
eb_db = 0:0.0001:25;
k = log2(m);
es_db = eb_db + 10*log(k) + 10*log(nsample);
es = db2mag(es_db);
p = 4*qfunc(sqrt(3*es/(m-1)));
semilogy(eb_db,p,colour(k));
hold on;
m = m*2;
end
xlabel('SNR ----->');
ylabel('Probability of Error ----->');
title('Error Probability Curve of M ary QAM');
grid on;
legend('m = 4','m = 8','m = 16','m = 32');
Output:
Enter the number of values to be compared = 4
Output Graph:
No comments:
Post a Comment