Question

In: Electrical Engineering

write a matlab code to simulate fiber optics communication system on matlab simulink

write a matlab code to simulate fiber optics communication system on matlab simulink

Solutions

Expert Solution

function output = ssprop_matlabfunction_modified(input)

nt = input(1);

u0 = input(2:nt+1);

dt = input(nt+2);

dz = input(nt+3);

nz = input(nt+4);

alpha_indB = input(nt+5);

betap = input(nt+6:nt+9);

gamma = input(nt+10);

P_non_thres = input(nt+11)

maxiter = input(nt+12);

tol = input(nt+13);

tic;

%tmp = cputime;

% This section solves the NLSE for pulse propagation in an optical fiber

using the SSF method

% The following effects are included: group velocity dispersion

% (GVD),higher order dispersion, loss, and self-phase modulation (gamma).

%

% USAGE

%

% u1 = ssprop(u0,dt,dz,nz,alpha,betap,gamma);

% u1 = ssprop(u0,dt,dz,nz,alpha,betap,gamma,maxiter);

% u1 = ssprop(u0,dt,dz,nz,alpha,betap,gamma,maxiter,tol);

%

% INPUT

%

% u0 - starting field amplitude (vector)

% dt - time step - [in ps]

% dz - propagation stepsize - [in km]

% nz - number of steps to take, ie, ztotal = dz*nz

% alpha - power loss coefficient [in dB/km], need to convert to linear to

% %have P=P0*exp(-alpha*z)

% betap - dispersion polynomial coefs, [beta_0 ... beta_m] [in ps^(m-1)/km]

% gamma - nonlinearity coefficient [in (km^-1.W^-1)]

% maxiter - max number of iterations (default = 4)

% tol - convergence tolerance (default = 1e-5)

%% OUTPUT

%% u1 - field at the output

%

% Convert alpha_indB to alpha in linear domain

%---------------

alpha = log(10)*alpha_indB/10; % alpha (1/km)

%---------------

ntt = length(u0);

w = 2*π*[(0:ntt/2-1),(-ntt/2:-1)]’/(dt*nt);

%w = 2*π*[(ntt/2:ntt-1),(1:ntt/2)]’/(dt*ntt);

clear halfstep

halfstep = -alpha/2;

for ii = 0:length(betap)-1;

halfstep = halfstep - j*betap(ii+1)*(w.^ii)/factorial(ii);

end

clear LinearOperator

% Linear Operator in Split Step method

LinearOperator = halfstep;

% pause

halfstep = exp(halfstep*dz/2);

u1 = u0;

ufft = fft(u0);

% Nonlinear operator will be added if the peak power is greater than the

% Nonlinear threshold

iz = 0;

while (iz < nz) & (max((abs(u1).^2 + abs(u0).^2)) > P_non_thres)

iz = iz+1;

uhalf = ifft(halfstep.*ufft);

for ii = 1:maxiter,

uv = uhalf .* exp(-j*gamma*(abs(u1).^2 + abs(u0).^2)*dz/2);

ufft = halfstep.*fft(uv);

uv = ifft(ufft);

%fprintf(‘You are using SSFM\n’);

if (max(uv-u1)/max(u1) < tol)

u1 = uv;

break;

else

u1 = uv;

end

end

if (ii == maxiter)

warning(sprintf(‘Failed to converge to %f in %d iterations’,...

tol,maxiter));

end

u0 = u1;

end

if (iz < nz) & (max((abs(u1).^2 + abs(u0).^2)) < P_non_thres)

% u1 = u1.*rectwin(ntt);

ufft == fft(u1);

ufft = ufft.*exp(LinearOperator*(nz-iz)*dz);

u1 = ifft(ufft);

%fprintf(‘Implementing Linear Transfer Function of the Fibre

Propagation’);

end

toc;

output = u1;

"I hope you like this"please hit like?


Related Solutions

Simulate the Spring Mass Damper System shown in Fig. Using MATLAB/Simulink, m being the mass of...
Simulate the Spring Mass Damper System shown in Fig. Using MATLAB/Simulink, m being the mass of Vibrating System in Kg. c Being the coefficient of damping in N-sec/m, K being spring stiffness in N/m. For the values m=15kg C=100 N-sec/m k=200 N/m mx''+cx'+kx=f0sinwt
How do I simulate the behaviour of the system in SIMULINK with different types of entrances...
How do I simulate the behaviour of the system in SIMULINK with different types of entrances like: sin wave, quadratic wave and pulse train. Please help!!
matlab code for over and under voltage protection relay simulink models not needed just matlab codes
matlab code for over and under voltage protection relay simulink models not needed just matlab codes
Create matlab simulink model for dc-dc buck converter with screenshot. Note: provide matlab code for the...
Create matlab simulink model for dc-dc buck converter with screenshot. Note: provide matlab code for the output of dc-dc buck converter if possible.
Write a short research paper to compare fiber optics versus copper or cable alternatives.
Write a short research paper to compare fiber optics versus copper or cable alternatives.
Write a MATLAB code for the conjugate gradient method and apply it to solve the system...
Write a MATLAB code for the conjugate gradient method and apply it to solve the system Hx = b, where H is the n×n Hilbert matrix, and b is A times the vector of all ones, for (a) n = 4; (b) n = 8. Compare your numerical solutions with the exact solution (which is the vector of all ones), and report your numerical errors.
(Optics) Write a program in Matlab that can plot the amplitude and energy reflection and transmission...
(Optics) Write a program in Matlab that can plot the amplitude and energy reflection and transmission coefficients for both polarizations as functions of incidence angle for any incidence dielectric medium into any other dielectric medium.
Develop a detailed model the inverted pendulum system in MatLab/Simulink (a feedback compensator to stabilise and...
Develop a detailed model the inverted pendulum system in MatLab/Simulink (a feedback compensator to stabilise and control the dynamics of a rotating inverted pendulum, as described in Microchip Application Note AN964, “Software PID Control of an Inverted Pendulum Using the PIC16F684” by Charais and Lourens. T)
How to model an inverted pendulum in matlab and simulink?
How to model an inverted pendulum in matlab and simulink?
Simulate using MATLAB and compare the BER of a 64-PSK system and a 64-QAM system with...
Simulate using MATLAB and compare the BER of a 64-PSK system and a 64-QAM system with Grey coding and Eb/No = 0, 2, 4, 6, 8, 10 dB. Must provide MATLAB code.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT