Beruflich Dokumente
Kultur Dokumente
APPARATUS REQUIRED:
MATLAB
Personal computer
PROCEDURE:
1. Open MATLAB software and open the new command editor window.
2. Type the coding of BPSK, QPSK, QAM, FSK, PSK, DPSK techniques.
3. Save the coding using .m extension.
4. Run the coding using the toolbar given.
5. Enter the input values if required.
6. Plot the obtained output waveforms.
close all;
clear all;
clc;
B = [1 0 0 1 0 0 1 1];
B_not = ~B;
count = 0;
Dk=[];
for i=1:1:length(B);
if(B(i)==0)
count = count + 1;
if(count>1)
Dk(i) =0;
else
Dk(i) = 1;
end
else
if(B(i)==1)
Dk(i)=1;
count = 0;
end
end
end
Dk_not = ~Dk;
Result = [];
Result1 = [];
Result2 = [];
Result1 = Dk & B;
Result2 = Dk_not & B_not;
Result = xor(Result1,Result2);
Final = [];
for i= 1:1:length(Result+1)
Final(1)=1;
Final(i+1)= Result(i);
end
Main_Final = ~ Final;
fs=1000;
f = 1;
Signal = [];
time = [];
t=0:1/fs:1;
for i=1:1: length(Main_Final);
Signal =[ Signal (Main_Final(i)==0)*sin(2*pi*f*t)+...
(Main_Final(i)==1)*-cos(2*pi*f*t)];
time=[time t];
t=t+1;
end
plot(time,Signal,'red','LineWidth',2.5);
axis([0 time(end) -2 2]);
xlabel('Time(t)');
title(['Differential Phase Shift Keying [' num2str(Main_Final) ']']);
ylabel('Amplitude');
grid on;
M ary-QAM modulation
clc;
clear all;
close all;
M=4;
%M=input(' enter the value of M array for QAM modulation :
'); fprintf('\n\n\n');
end
t1=bp/100:bp/100:100*length(x)*(bp/100);
figure(1)
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('transmitting information as digital signal');
% binary information convert into symbolic form for M-array QAM modulation
M=M; % order of QAM modulation
msg_reshape=reshape(msg,log2(M),nbit/log2(M))';
disp(' information are reshaped for convert symbolic form');
disp(msg_reshape);
fprintf('\n\n');
size(msg_reshape);
for(j=1:1:nbit/log2(M))
for(i=1:1:log2(M))
a(j,i)=num2str(msg_reshape(j,i));
end
end
as=bin2dec(a);
ass=as';
figure(1)
subplot(3,1,2);
stem(ass,'Linewidth',2.0);
title('serial symbol for M-array QAM modulation at transmitter');
xlabel('n(discrete time)');
ylabel(' magnitude');
bi_in=dec2bin(ax);
[row col]=size(bi_in);
p=1;
for(i=1:1:row)
for(j=1:1:col)
re_bi_in(p)=str2num(bi_in(i,j));
p=p+1;
end
end
disp('re-obtain binary information after M-array QAM demodulation');
disp(re_bi_in')
fprintf('\n\n');
end
t1=bp/100:bp/100:100*length(x)*(bp/100);
figure(3)
subplot(2,1,2);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('receiving information as digital signal after M-array QAM demoduation');
RESULT
The program for BPSK, QPSK, QAM, FSK, PSK and DPSK modulation and
demodulation has been simulated in MATLAB and necessary graphs are plotted.