DC practicals
QAM
clc;
M=4;
N=200;
EbNo=60;
X=randint(N,1,M);
plot(X);
xlabel('time');
ylabel('Amplitude');
scatterplot(X);
Y=qammod(X,M);
scatterplot(Y);
Yn=awgn(Y,EbNo,'measured');
scatterplot(Yn);
X1=qamdemod(Yn,M);
scatterplot(X1);
[num,rt]=symerr(X,X1);
EbNo=0:1:20;
ber=berawgn(EbNo,'qam',M);
semilogy(EbNo,ber,'*-b')
title('Bit Error Rate');
xlabel('signal to noise ratio');
ylabel('probability of error');
BPSK
clc;
M=4;
N=100;
EbNo=40;
X=randint(N,1,M);
plot(X); xlabel('time');
ylabel('Amplitude');
scatterplot(X);
Y=pskmod(X,M);
scatterplot(Y);
Yn=awgn(Y,EbNo,'measured');
scatterplot(Yn);
X1=pskdemod(Yn,M);
scatterplot(X1);
[num,rt]=symerr(X,X1);
EbNo=0:1:20;
ber=berawgn(EbNo,'psk',M,'nondiff');
semilogy(EbNo,ber,'*-b');
title('Bit error Rate');
xlabel('signal to noise ratio');
ylabel('probability of error');
QPSK
clc;
M=2;
N=100;
EbNo=40;
X=randint(N,1,M);
plot(X); xlabel('time');
ylabel('Amplitude');
scatterplot(X);
Y=pskmod(X,M);
scatterplot(Y);
Yn=awgn(Y,EbNo,'measured');
scatterplot(Yn);
X1=pskdemod(Yn,M);
scatterplot(X1);
[num,rt]=symerr(X,X1);
EbNo=0:1:20;
ber=berawgn(EbNo,'psk',M,'nondiff');
semilogy(EbNo,ber,'*-b');
title('Bit error Rate');
xlabel('signal to noise ratio');
ylabel('probability of error');
ISI
clc;
M=4;
Fd=1;
Fs=10;
Pd=500;
m=randint(Pd,1,M);
plot(m) scatterplot(m);
Y=pskmod(m,m);
scatterplot(Y);
delay=3;
rev=rcosf1t(Y,Fd,Fs,F1r/normal:.5,delay);
N=Fs/Fd;
propdelay=delay.*N+1;
rcv1=rcv(propdelay:end-(propdalay-1));
offset1=0;
e=eyediagram(rcv1,N,1/Fd,offst1);
set(e,'name','eye diagram displayed with no offset');
Y1=pskdemod(Y,M);
scatterplot(Y1);
Awesome
ReplyDelete