Home Forums SYSTEM About MATLAB component

About MATLAB component

Profile Photo
(joined December 2019)
Participant

Hello
I wrote the Fabry-Perot interferometer code in MATLAB.
But it doesn’t output well.
Please let me know if you make any mistakes.

%
% This program simulates an Fabry-Perot
%
OutputPort1 = InputPort1;
% constant
Rx = 0.45; % reflectance of translucent film
Tx = 0.45; % transmittance of translucent film
Ry = 0.9; % reflectance of reflective film
L = Parameter0; % Distance between reflective film and translucent film [m]
c = 3.0e8; % speed of light [1/m]
lambda =1.5e-6; %wavelength range [m]

f = c./lambda; %frequency[Hz]
omega = 2*pi*f; % each frequency [rad/s]
phi = 2*L*omega/c;
% calculate the optical signal
if(InputPort1.TypeSignal == ‘Optical’)
% verify how many sampled signals are in the structure
[ls, cs] = size(InputPort1.Sampled);
if( ls > 0 )
% caculate the at each signal
for counter1=1:cs
OutputPort1.Sampled(1, counter1).Signal = InputPort1.Sampled(1, counter1).Signal *((Tx^2+Rx^2)*Ry-Rx)^2 +…
(4*Rx*Ry*(Tx^2+Rx^2)*(sin(phi/2)).^2)./(((1-Rx*Ry)^2) +…
4*Rx*Ry*(sin(phi/2)).^2);
end
end
end

Responses (1):

    • #62802
      Profile Photo
      YU IRITA
      Participant

      Hello
      I wrote the Fabry-Perot interferometer code in MATLAB.
      But it doesn’t output well.
      Please let me know if you make any mistakes.

      %
      % This program simulates an Fabry-Perot
      %
      OutputPort1 = InputPort1;
      % constant
      Rx = 0.45; % reflectance of translucent film
      Tx = 0.45; % transmittance of translucent film
      Ry = 0.9; % reflectance of reflective film
      L = Parameter0; % Distance between reflective film and translucent film [m]
      c = 3.0e8; % speed of light [1/m]
      lambda =1.5e-6; %wavelength range [m]

      f = c./lambda; %frequency[Hz]
      omega = 2*pi*f; % each frequency [rad/s]
      phi = 2*L*omega/c;
      % calculate the optical signal
      if(InputPort1.TypeSignal == ‘Optical’)
      % verify how many sampled signals are in the structure
      [ls, cs] = size(InputPort1.Sampled);
      if( ls > 0 )
      % caculate the at each signal
      for counter1=1:cs
      OutputPort1.Sampled(1, counter1).Signal = InputPort1.Sampled(1, counter1).Signal *((Tx^2+Rx^2)*Ry-Rx)^2 +…
      (4*Rx*Ry*(Tx^2+Rx^2)*(sin(phi/2)).^2)./(((1-Rx*Ry)^2) +…
      4*Rx*Ry*(sin(phi/2)).^2);
      end
      end
      end

    • #63247
      Profile Photo
      Ahmad Atieh
      Participant

      Hello,
      Is it possible that you send me your project layout and the Matlab code to check it out? Please email them as a zip file to @optiwave.com">ahmad.atieh@optiwave.com.
      The only thing that I see in the code that you are missing to define the type of signal in the Matlab code (optical, electrical, binary or Mary). You need to match that with the signal type at the input and output ports of the Matlab component in OptiSystem project layout.

      Regards,
      Ahmad

      +1

LoginYou must be logged in to reply to this topic.