Forum Options

Home Forums SYSTEM About MATLAB component 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 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 