Home Forums SYSTEM About MATLAB component

Viewing 1 reply thread
  • Author
    Posts
    • #62802
      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
      Ahmad Atieh
      Moderator

      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 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

Viewing 1 reply thread
  • You must be logged in to reply to this topic.