Program:
clc;
clear all;
n = input('Enter the number of values to be compared = ');
colour = ['k', 'g', 'r', '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);
z = sqrt(6*es/(m*(m-1)));
p = 2*((m-1)/m)*qfunc(z);
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 PAM');
grid on;
legend('m = 4','m = 8', 'm = 16', 'm = 32');
Output:
Enter the number of values to be compared = 3
Output Graph:
clc;
clear all;
n = input('Enter the number of values to be compared = ');
colour = ['k', 'g', 'r', '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);
z = sqrt(6*es/(m*(m-1)));
p = 2*((m-1)/m)*qfunc(z);
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 PAM');
grid on;
legend('m = 4','m = 8', 'm = 16', 'm = 32');
Output:
Enter the number of values to be compared = 3
Output Graph:
No comments:
Post a Comment