I am doing my research on OFDM in LONG HAUL COMMUNICATION and prepared a program but after varying values i am not able to get the results kindly help me i am attaching the program help me in varying values and obtaining the result

2 次查看(过去 30 天)
clear all;
clc;
clf;
cputime;
tic;
%--------------------------USER INPUTS-----------------------
total_length=40; % ENTER IN KM
numberbits=4; % ENTER (if changing this change nobits)
nobit = [1 0 1 1]; % ENTER (consider numberbits)
%------------------------------------------------------------
%-----------------------SMF Characteristics------------------
gamma=0.31; %Non-linear coefficient of SMF
alpha=0.2;%Attenuation of SMF (db/km)
beta2=-16e-24; %2nd order GVD of SMF(ps^2/km)
%------------------------------------------------------------
i=sqrt(-1);
Po=0.517; %Input Power
Ao=sqrt(Po); %Amplitude
PPo=0.00012;
AAo=sqrt(PPo);
n=8192;
to=10e-12; %Initial Pulse Width in second (10ps)
dt=10e-15; %Ten femto-seconds, difference between 2 consecutive samples
pi=3.1415926535;
Ld=(to^2)/(abs(beta2)); %Dispersion length
Ln=1/(gamma*Po); %Nonlinear length
N=Ld/Ln;
h=0.1; %in km
tp=n*dt;
tt=tp/2;
step_size=2*h;
L=total_length/step_size;
%--------------Defining tau2 for the numberbits--------------
new=n*numberbits;
tp1=dt*new;
tt1=tp1/2;
for j=1:1:new
t1(j)=-tt1+((j-1)*((2*tt1)/new));
tau2(j)=t1(j)/to;
end;
%------------------------------------------------------------
%-----------------------Gaussian wave------------------------
for j=1:1:n
t(j)=-tt+((j-1)*((2*tt)/n));
tau(j)=t(j)/to;
f(j)=Ao*exp(-tau(j).^2);
end;
%------------------------------------------------------------
%------------------------Zerowave----------------------------
for j=1:1:n
t(j)=-tt+((j-1)*((2*tt)/n));
tau(j)=t(j)/to;
zerowave(j)=AAo*exp(-tau(j).^2);
end;
%------------------------------------------------------------
%-----------------------calculating w -----------------------
wp=1/(2*tt);
for j=1:1:n
if j<(n/2)
w(j)=2*pi*wp*(j-1);
else
w(j)=2*pi*wp*(j-(n+1));
end;
end;
%------------------------------------------------------------
q8=f;
qq8=zerowave;
%-----------------------------SMF----------------------------
%for 1
zz=1;
for k=1:1:L;
q1=fft(q8);
q2=q1.*exp(((-alpha/2)+i*(beta2/2)*(w.^2))*(h/2));
q3=ifft(q2);
q4=q3.*exp(i*gamma*(abs(q3).^2)*h);
q5=fft(q4);
q6=q5.*exp(((-alpha/2)+i*(beta2/2)*(w.^2))*(h/2));
q7=ifft(q6);
q8=q7;
figure(1), plot (tau, f, tau, q8);
xlabel('Time (tau)');
ylabel('Amplitude');
hleg1 = legend('Input Gaussian Wave','SMF O/P');
grid on;
q8dummy(zz,:)=abs(q8);
zz=zz+1;
k;
end;
zz=zz-1;
figure(2), mesh(q8dummy(1:1:zz,:));
xlabel('Time');
ylabel('Distance*200(m)');
zlabel('Amplitude');
%for 0
zz=1;
for k=1:1:L;
qq1=fft(qq8);
qq2=qq1.*exp(((-alpha/2)+i*(beta2/2)*(w.^2))*(h/2));
qq3=ifft(qq2);
qq4=qq3.*exp(i*gamma*(abs(qq3).^2)*h);
qq5=fft(qq4);
qq6=qq5.*exp(((-alpha/2)+i*(beta2/2)*(w.^2))*(h/2));
qq7=ifft(qq6);
qq8=qq7;
zerowavedummy(zz,:)=abs(qq8);
zz=zz+1;
k;
end;
zz=zz-1;
%--------------------Concatenating the bits------------------
x=[];
x1=[];
x3=[];
for p=1:1:numberbits
if nobit(p)==1
x=[x f]; %initial input
x1=[x1 q8]; %after EDFA (Final)
x3=[x3 q8dummy];
else
x=[x zerowave];
x1=[x1 qq8];
x3=[x3 zerowavedummy];
end;
p;
end;
%------------------------------------------------------------
figure(3), plot (tau2, x, tau2, x1);
xlabel('Time (tau)');
ylabel('Amplitude');
hleg1 = legend('Input Bit Sequence','SMF O/P');
grid on;
figure(4), mesh(x3(1:1:zz,:));
xlabel('Time');
ylabel('Distance*200(m)');
zlabel('Amplitude');
%------------------------------------------------------------
toc;
cputime=toc;
disp('CPU time:'), disp(cputime);
  1 个评论
Walter Roberson
Walter Roberson 2016-7-15
Which values are you varying? What results are you not getting? Describe the difference between what you expect and what you obtain. When you used the debugger to trace your code, which parts did you become certain were working correctly and which parts were you left unsure of?

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by