matlab code for dpsk modulation and demodulation
#1

: Hi am Mohit.d i would like to get details on matlab code for dpsk modulation and demodulation .
Reply
#2

The following code is for simulating non-coherent DPSK for M=2,4,8,16,32 (bits per symbol).

This code is extended from the examples available in the ebook.


% Iman Bagheri / December 2013 / imaanibagheri[at]gmail.com
% Simple Matlab/Octave code for non-coherent demodulation of
% differentially encoded phase shift keying (DPSK)
clc;clear all;close all;

%———Input Fields————————
N = 1e6; % number of bits or symbols
EbN0dB = 6:2:16; % multiple Eb/N0 values
rangeofM = [2,4,8,16,32]; % DPSK constellation
colors=['b','r','g','k','m'];
%———————————————

colorIndex=1;
legendString=cell(1,10);

figure;
%— Reference Constellation for demodulation and Error rate computation–
for M =rangeofM,
display(M)
switch M
case 2
% Constellation 2-DPSK
refArray = [ 1.0000 + 0.0000i 0.0000 + 1.0000i -1.0000 + 0.0000i -0.0000 - 1.0000i];

case 4
% Constellation 4-DPSK
refArray = [ 1.0000 + 0.0000i 0.7071 + 0.7071i 0.0000 + 1.0000i -0.7071 + 0.7071i ...
-1.0000 + 0.0000i -0.7071 - 0.7071i -0.0000 - 1.0000i 0.7071 - 0.7071i];

case 8
% Constellation 8-DPSK
refArray = [ 1.0000 + 0.0000i 0.9239 + 0.3827i 0.7071 + 0.7071i 0.3827 + 0.9239i ...
0.0000 + 1.0000i -0.3827 + 0.9239i -0.7071 + 0.7071i -0.9239 + 0.3827i ...
-1.0000 + 0.0000i -0.9239 - 0.3827i -0.7071 - 0.7071i -0.3827 - 0.9239i ...
-0.0000 - 1.0000i 0.3827 - 0.9239i 0.7071 - 0.7071i 0.9239 - 0.3827i];

case 16
% Constellation 16-DPSK
refArray = [ 1.0000 + 0.0000i 0.9808 + 0.1951i 0.9239 + 0.3827i 0.8315 + 0.5556i ...
0.7071 + 0.7071i 0.5556 + 0.8315i 0.3827 + 0.9239i 0.1951 + 0.9808i ...
0.0000 + 1.0000i -0.1951 + 0.9808i -0.3827 + 0.9239i -0.5556 + 0.8315i ...
-0.7071 + 0.7071i -0.8315 + 0.5556i -0.9239 + 0.3827i -0.9808 + 0.1951i ...
-1.0000 + 0.0000i -0.9808 - 0.1951i -0.9239 - 0.3827i -0.8315 - 0.5556i ...
-0.7071 - 0.7071i -0.5556 - 0.8315i -0.3827 - 0.9239i -0.1951 - 0.9808i ...
-0.0000 - 1.0000i 0.1951 - 0.9808i 0.3827 - 0.9239i 0.5556 - 0.8315i ...
0.7071 - 0.7071i 0.8315 - 0.5556i 0.9239 - 0.3827i 0.9808 - 0.1951i];
case 32
% Constellation 32-DPSK
refArray = [ 1.0000 + 0.0000i 0.9952 + 0.0980i 0.9808 + 0.1951i 0.9569 + 0.2903i ...
0.9239 + 0.3827i 0.8819 + 0.4714i 0.8315 + 0.5556i 0.7730 + 0.6344i ...
0.7071 + 0.7071i 0.6344 + 0.7730i 0.5556 + 0.8315i 0.4714 + 0.8819i ...
0.3827 + 0.9239i 0.2903 + 0.9569i 0.1951 + 0.9808i 0.0980 + 0.9952i ...
0.0000 + 1.0000i -0.0980 + 0.9952i -0.1951 + 0.9808i -0.2903 + 0.9569i ...
-0.3827 + 0.9239i -0.4714 + 0.8819i -0.5556 + 0.8315i -0.6344 + 0.7730i ...
-0.7071 + 0.7071i -0.7730 + 0.6344i -0.8315 + 0.5556i -0.8819 + 0.4714i ...
-0.9239 + 0.3827i -0.9569 + 0.2903i -0.9808 + 0.1951i -0.9952 + 0.0980i ...
-1.0000 + 0.0000i -0.9952 - 0.0980i -0.9808 - 0.1951i -0.9569 - 0.2903i ...
-0.9239 - 0.3827i -0.8819 - 0.4714i -0.8315 - 0.5556i -0.7730 - 0.6344i ...
-0.7071 - 0.7071i -0.6344 - 0.7730i -0.5556 - 0.8315i -0.4714 - 0.8819i ...
-0.3827 - 0.9239i -0.2903 - 0.9569i -0.1951 - 0.9808i -0.0980 - 0.9952i ...
-0.0000 - 1.0000i 0.0980 - 0.9952i 0.1951 - 0.9808i 0.2903 - 0.9569i ...
0.3827 - 0.9239i 0.4714 - 0.8819i 0.5556 - 0.8315i 0.6344 - 0.7730i ...
0.7071 - 0.7071i 0.7730 - 0.6344i 0.8315 - 0.5556i 0.8819 - 0.4714i ...
0.9239 - 0.3827i 0.9569 - 0.2903i 0.9808 - 0.1951i 0.9952 - 0.0980i];

end

symErrSimulated = zeros(1,length(EbN0dB));
k = log2(M); % number of bits per symbol
EsN0dB = EbN0dB + 10*log10(k);

%—Generating a uniformly distributed random numbers in the set [0,1,2,..,2M-1]
data = 2*ceil(M.*rand(N,1))-1;

%—generating differential modulated symbols
% phi[k] = phi[k-1] + Dphi[k]
data_diff = filter(1,[1 -1],data); % start with 0 phase
s = refArray(mod(data_diff,2*M)+1);

%—Place holder for Symbol Error values for each Es/N0 for particular M value–
index =1;

for x = EsN0dB,
%——————————————-
%Channel Noise for various Es/N0
%——————————————-
%Adding noise with variance according to the required Es/N0
noiseVariance = 1/(10.^(x/10));%Standard deviation for AWGN Noise
noiseSigma = sqrt(noiseVariance/2);
%Creating a complex noise for adding with M-PSK modulated signal
%Noise is complex since M-PSK is in complex representation
noise = noiseSigma*(randn(1,N)+1i*randn(1,N));
received = s + noise; % additive white gaussian noise

%————-I-Q Branching—————
% non-coherent demodulation
estPhase = angle(received);
% Dphi[k] = phi[k] – phi[k-1]
est_diffPhase = filter([1 -1],1,estPhase)*M/pi;

%—Decision Maker-Compute—————
y = mod(2*floor(est_diffPhase/2)+1,2*M); % quantizing

%————–Symbol Error Rate Calculation——————————-
symErrSimulated(1,index) = sum(y~=data')/(N*k);
index=index+1;
end

%—– Compute Theoretical Symbol Error Rates ———————
%EsN0lin = 10.^(EsN0dB/10);
EbN0lin = 10.^(EbN0dB/10);
switch M
case 2
% Binary DPSK
%symErrTheory = 0.5*exp(-EbN0lin);
symErrTheory = [0.183939720585721 0.141979500801581 0.102484842127614 ...
0.067988990214236 0.040557538392161 0.021164609811602 ...
0.009332812280759 0.003329212408816 0.000909404448079 ...
0.000177519600853 0.000022699964881 0.000001704222951 ...
0.000000065443471 0.000000001080577 0.000000000006166 ...
0.000000000000009 0.000000000000000 0.000000000000000 ];
case 4
% Differential QPSK
%a=sqrt(2*EbN0lin*(1-sqrt(1/2)));
%b=sqrt(2*EbN0lin*(1+sqrt(1/2)));
%symErrTheory = marcumq(a,b,1)-1/2.*besseli(0,a.*b).*exp(-1/2*(a.^2+b.^2));
symErrTheory = [0.163915782266879 0.130340353948448 0.099340421148833 ...
0.071869728598461 0.048749014238557 0.030494396050703 ...
0.017235903419554 0.008580057996167 0.003642946260782 ...
0.001267104127630 0.000343192915859 0.000067892932192 ...
0.000009052660025 0.000000735017339 0.000000031977237 ...
0.000000000635827 0.000000000003089 0.000000000000007 ];
case 8
symErrTheory = [0.196675320594916 0.168799069367571 0.143259404905542 ...
0.119998893639366 0.098698763280930 0.079010610808322 ...
0.060880009244594 0.044595058027306 0.030628544606260 ...
0.019407939124153 0.011123484946738 0.005625145220373 ...
0.002432717332426 0.000865008450586 0.000240644104472 ...
0.000049204284217 0.000006834131510 0.000000583844516 ];
case 16
symErrTheory = [0.243074286641906 0.218961084181130 0.195636576083976 ...
0.173346218117303 0.152347699061127 0.132844412178026 ...
0.114865468034590 0.098250190259514 0.082723802722015 ...
0.068052705520753 0.054189237989625 0.041325099979299 ...
0.029825850007615 0.020093727460903 0.012425714485646 ...
0.006906628353420 0.003360747495832 0.001384823107176 ];
case 32
symErrTheory = [0.282159201893397 0.262866216107126 0.244005575175439 ...
0.225547469806512 0.207369762783772 0.189326601312768 ...
0.171408441450489 0.153784137864677 0.136740490766681 ...
0.120568432564742 0.105461710785496 0.091458039575941 ...
0.078439736690143 0.066204165894016 0.054584201989410 ...
0.043560046102459 0.033298163658265 0.024098747991940 ];
end

%—————Plotting commands———————–

semilogy(EbN0dB,symErrTheory(EbN0dB+1),colors(colorIndex),'LineWidth',1.5);hold on;
semilogy(EbN0dB,symErrSimulated,[colors(colorIndex),'*'],'LineWidth',1.5);hold on;
legendString{2*colorIndex-1} = [num2str(M),' DPSK Theory'];
legendString{2*colorIndex}=[num2str(M), ' DPSK Simulated'];
colorIndex=colorIndex+1;
end
legend(legendString)

xlabel('Eb/N0(dB)');
ylabel('Bit Error Rate (Pb)');
title('Simulation BER vs. Theoretical BER for Digital Modulation');
grid on;
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Tagged Pages: dpsk modulation matlab code,
Popular Searches: dpsk modulation and demodulation, matlab code for dpsk modulation and demodulationf the, qpsk demodulation using matlab code, matlab code for dpsk modulation, c code for qpsk modulation and demodulation, dpsk modulation, matlab code for dpsk modulation and demodulation,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  well-spring some homemade barbecue backchat and moistureless rubs and the actuality 0 1,038 10-09-2019, 05:48 PM
Last Post:
  agent some homemade barbecue cheek and prosaic rubs and suit 0 959 10-09-2019, 07:04 AM
Last Post:
  pass some homemade barbecue coolness and arid rubs and module 0 911 09-09-2019, 06:35 PM
Last Post:
  matlab code 1 3,451 31-01-2019, 02:52 PM
Last Post: [email protected]
  underwater optical communication matlab code 0 3,292 02-11-2018, 07:32 PM
Last Post: Guest
  source code for blood group detection in matlab 0 6,446 22-10-2018, 10:59 AM
Last Post: Guest
  hackchina matlab code 0 630 27-09-2018, 10:45 PM
Last Post: Guest
  heart disease prediction system source code for matlab 0 771 27-09-2018, 04:40 PM
Last Post: Guest
  techmax ebooks activation code for computer architecture and organization 0 765 21-08-2018, 08:54 PM
Last Post: Guest
  matlab code for echo hiding 1 790 17-08-2018, 07:35 PM
Last Post: Guest

Forum Jump: