% Create an output structure similar to the input
OutputPort1 = InputPort1;
% Attenuation constant
A = Parameter0;%attenuation of fiber db/km
L=Parameter1;%Length of fiber in km
D=Parameter2;%dispersion of fiber
% calculate the optical signal attenuation
if strcmp(InputPort1.TypeSignal ,'Optical')
% verify how many sampled signals are in the structure
[ls, cs] = size(InputPort1.Sampled);
if( ls > 0 )
% caculate the attenuation at each signal
for counter1=1:cs
OutputPort1.Sampled(1, counter1).Signal = InputPort1.Sampled(1, counter1).Signal * 10^((-1 * A*L) / 10);
end
end
[lp, cp] = size(InputPort1.Parameterized);
  if( lp > 0 )
OutputPort1.Parameterized.Linewidth = InputPort1.Parameterized.Linewidth .*L*D ;
OutputPort1.Parameterized.Power = InputPort1.Parameterized.Power .*(10^((-A*L)/10)) ;

  end
end