Beam Profile Fibra Óptica + C-Lens usando la Teoría ABCD Matrix (Código Fuente App Designer MATLAB) - Ceiba Technologies

Breaking

TU BANNER AQUÍ

sábado, 29 de abril de 2023

Beam Profile Fibra Óptica + C-Lens usando la Teoría ABCD Matrix (Código Fuente App Designer MATLAB)

En este artículo muestro un pequeño programa que hice en App Designer para simular el comportamiento del beam profile (es decir, el perfil del beam de luz) de un colimador clásico a base de un C-lens y Fibra Óptica
Estos componentes son pieza clave que se utilizan en aplicaciones como módulos DWDM (MUX/DEMUX), Channeles, etc. En general, aplicaciones de telecomunicaciones. 

La componente básica es una lente llamada C-lens de típicamente unos 5 mm de largo y 2mm de diámetro, aunque sus medidas varían dependiendo de la aplicación. Esta lente esta unida a cierta distancia de una fibra óptica (hay diferentes métodos para lograrlo). La función principal de un colimador es como su nombre indica, colimar la luz. No entraremos en muchos detalles por el momento (será abordado en otro artículo), por el momento solo basta decir que esta configuración óptica puede ser tratada mediante las llamadas Matrices ABCD. Gracias a ello podemos saber con bastante certeza el comportamiento óptico de la luz pasando a través de la lente, y con ello poder calcular otras propiedades muy importantes como lo son el Insertion Loss (IL) o el Return Loss (RL) ambas son propiedades clásicas de los componentes ópticos utilizados en el mundo de las telecomunicaciones.

En mi propia experiencia, es muy útil tener un programa que te permita ver en tiempo real el comportamiento óptico de una configuración al variar sus parámetros. Es por ello que hice este pequeño programa para dos tipos de lentes: C-lens y G-lens (GRIN lens).

Sé que hay mucho qué decir acerca de sus aplicaciones, tipos de lentes, método de simulación, etc. Son temas muy interesantes pero también muy amplios.

Todo ello será abordado en próximos artículos. Aquí solo se presentará el desarrollo que hice usando el software App Designer de MATLAB.

Pero primero que nada la configuración de un colimador y del problema a abordar.

Geometría típica de un colimador a base de un C-lens y Fibra Óptica


La geometría se presenta a continuación:

Fig. 1. Geometría básica de un Colimador compuesto por Fibra Óptica + C-Lens.



Como puede verse de la imagen, las propiedades geométricas importantes son: su longitud L y Radio de curvatura (R). Y sus propiedades ópticas: su Índice de Refracción (n). Para el caso de la fibra óptica lo que nos interesa es su MFD (en inglés Mode Field Diameter). Por cierto, muy importante: estamos hablando de un Haz Gausiano típico de fibra óptica Single Mode. Además, usando las típicas longitudes de onda para telecomunicaciones: 1550 nm y 1320 nm.



¿Qué es App Designer (MATLAB)?



MATLAB es un lenguaje de programación y entorno de desarrollo ampliamente utilizado en ingeniería y ciencias para el análisis y visualización de datos, la simulación de sistemas, el modelado de procesos y mucho más. Con la creciente demanda de aplicaciones móviles, MATLAB ofrece una herramienta llamada App Designer para crear aplicaciones con una interfaz de usuario gráfica.

App Designer permite a los usuarios diseñar y desarrollar aplicaciones interactivas en MATLAB sin necesidad de experiencia previa en programación de interfaces gráficas de usuario (GUI). La herramienta proporciona una interfaz de usuario intuitiva que incluye un editor de diseño, un panel de control y una barra de herramientas, lo que facilita la creación de aplicaciones personalizadas.

Con App Designer, los usuarios pueden diseñar una interfaz gráfica con una variedad de componentes, como botones, cajas de texto, gráficos, listas desplegables y mucho más. Los usuarios también pueden agregar código personalizado para controlar la funcionalidad de la aplicación. Los componentes y la funcionalidad se pueden arrastrar y soltar en la interfaz de usuario, lo que facilita la creación de aplicaciones personalizadas.

Además, App Designer también tiene una función de previsualización, lo que permite a los usuarios probar su aplicación mientras la diseñan. Esto significa que los usuarios pueden detectar y corregir errores y problemas de diseño en tiempo real antes de publicar su aplicación final.

En resumen, App Designer de MATLAB es una herramienta útil para diseñar y desarrollar aplicaciones móviles personalizadas con una interfaz gráfica intuitiva. Con su funcionalidad fácil de usar y su capacidad de previsualización, App Designer hace que sea fácil para los usuarios crear aplicaciones personalizadas sin la necesidad de experiencia en programación de interfaces gráficas de usuario.


Screenshots de la aplicacón en App Designer (MATLAB)



Dicho lo anterior, presento mis resultados.
Primero, aquí tienes screenshots de cómo va la aplicación:



Simulación Colimador C-lens G-lens + Fibra óptica
Fig. 2. Pestaña #1. Beam profile para configuración C-lens.


Simulación Beam Profiler Colimador C-lens + Fibra óptica

                               Fig. 3. Pestaña #2. Beam profile para configuración G-lens.



Matrix ABCD simulación Colimador C-lens + Fibra óptica

Fig. 4. Pestaña #3. Teoría óptica para configuración C-lens.


MATLAB simulación Colimador C-lens + Fibra óptica

                               Fig. 5. Pestaña #4. Dibujos y teoría para configuración C-lens.


App Designer simulación Colimador C-lens + Fibra óptica
                              Fig. 6. Pestaña #5. Dibujos y teoría para una configuración G-lens.



Y ahora el Código Fuente, recuerda que esto funciona para App Designer (MATLAB):


Inicio de Código

---------------------------------------------------------------------------------------------------------------------------


classdef Collimator_01 < matlab.apps.AppBase


    % Properties that correspond to app components

    properties (Access = public)

        UIFigure                    matlab.ui.Figure

        TabGroup                    matlab.ui.container.TabGroup

        CLensTab                    matlab.ui.container.Tab

        CLensConstants1550nmPanel   matlab.ui.container.Panel

        lEditFieldLabel             matlab.ui.control.Label

        lEditField                  matlab.ui.control.NumericEditField

        lEditFieldLabel_2           matlab.ui.control.Label

        lEditFieldLabel_3           matlab.ui.control.Label

        w01EditFieldLabel           matlab.ui.control.Label

        w01EditField                matlab.ui.control.NumericEditField

        n1EditFieldLabel            matlab.ui.control.Label

        n1EditField                 matlab.ui.control.NumericEditField

        n2EditFieldLabel            matlab.ui.control.Label

        n2EditField                 matlab.ui.control.NumericEditField

        LmmEditFieldLabel           matlab.ui.control.Label

        LmmEditField                matlab.ui.control.NumericEditField

        RmmEditFieldLabel           matlab.ui.control.Label

        RmmEditField                matlab.ui.control.NumericEditField

        UIAxes                      matlab.ui.control.UIAxes

        PlotFiberButton             matlab.ui.control.Button

        GaussianBeamProfileLabel    matlab.ui.control.Label

        ParametersPanel             matlab.ui.container.Panel

        z2mmEditFieldLabel          matlab.ui.control.Label

        z2mmEditField               matlab.ui.control.NumericEditField

        w02umEditFieldLabel         matlab.ui.control.Label

        w02umEditField              matlab.ui.control.NumericEditField

        WDmmEditFieldLabel          matlab.ui.control.Label

        WDmmEditField               matlab.ui.control.NumericEditField

        CalculationButton           matlab.ui.control.Button

        z1mmSliderLabel             matlab.ui.control.Label

        z1mmSlider                  matlab.ui.control.Slider

        z1mmEditFieldLabel          matlab.ui.control.Label

        z1mmEditField               matlab.ui.control.NumericEditField

        SavePlotCLensButton         matlab.ui.control.Button

        PlotCLensButton             matlab.ui.control.Button

        GLensTab                    matlab.ui.container.Tab

        GLensConstants1550nmPanel   matlab.ui.container.Panel

        lEditField_2Label           matlab.ui.control.Label

        lEditField_2                matlab.ui.control.NumericEditField

        lEditFieldLabel_4           matlab.ui.control.Label

        lEditFieldLabel_5           matlab.ui.control.Label

        wG01EditFieldLabel          matlab.ui.control.Label

        wG01EditField               matlab.ui.control.NumericEditField

        n1EditField_2Label          matlab.ui.control.Label

        n1EditField_2               matlab.ui.control.NumericEditField

        nG2EditFieldLabel           matlab.ui.control.Label

        nG2EditField                matlab.ui.control.NumericEditField

        LGmmEditFieldLabel          matlab.ui.control.Label

        LGmmEditField               matlab.ui.control.NumericEditField

        hmm1EditFieldLabel          matlab.ui.control.Label

        hmm1EditField               matlab.ui.control.NumericEditField

        UIAxes_2                    matlab.ui.control.UIAxes

        PlotFiberButton_2           matlab.ui.control.Button

        GaussianBeamProfileLabel_2  matlab.ui.control.Label

        ParametersPanel_2           matlab.ui.container.Panel

        zG2mmEditFieldLabel         matlab.ui.control.Label

        zG2mmEditField              matlab.ui.control.NumericEditField

        wG02umEditFieldLabel        matlab.ui.control.Label

        wG02umEditField             matlab.ui.control.NumericEditField

        WDmmEditField_2Label        matlab.ui.control.Label

        WDmmEditField_2             matlab.ui.control.NumericEditField

        CalculationButton_2         matlab.ui.control.Button

        zG1mmSliderLabel            matlab.ui.control.Label

        zG1mmSlider                 matlab.ui.control.Slider

        zG1mmEditFieldLabel         matlab.ui.control.Label

        zG1mmEditField              matlab.ui.control.NumericEditField

        SavePlotGLensButton         matlab.ui.control.Button

        PlotGLensButton             matlab.ui.control.Button

        EquationsCLensTab           matlab.ui.container.Tab

        Image3                      matlab.ui.control.Image

        Image4                      matlab.ui.control.Image

        DrawingsCLensTab            matlab.ui.container.Tab

        Image                       matlab.ui.control.Image

        Image2                      matlab.ui.control.Image

        Image5                      matlab.ui.control.Image

        DrawingsGLensTab            matlab.ui.container.Tab

        Image8                      matlab.ui.control.Image

        OffButton                   matlab.ui.control.Button

        OnButton                    matlab.ui.control.Button

        TestButton                  matlab.ui.control.Button

        TestEditFieldLabel          matlab.ui.control.Label

        TestEditField               matlab.ui.control.NumericEditField

        InformationTextAreaLabel    matlab.ui.control.Label

        InformationTextArea         matlab.ui.control.TextArea

        Image6                      matlab.ui.control.Image

        Image7                      matlab.ui.control.Image

        Image9                      matlab.ui.control.Image

    end




    % Callbacks that handle component events

    methods (Access = private)


        % Button pushed function: PlotFiberButton

        function PlotFiberButtonPushed(app, event)

        

        

        w01 = app.w01EditField.Value;

        l = app.lEditField.Value; % wavelentgh um

        z1 = app.z1mmEditField.Value*1000; %Value of z01 

        gam01 = (pi*(w01)^2)/l;

                     

        % Gaussian Profile

        x =  -1:0.05:3   ;

        y = w01*sqrt(1 + (((x*1000) - z1)/gam01).^2);

        y2 = -w01*sqrt(1 + (((x*1000) - z1)/gam01).^2);

        

        plot(app.UIAxes,x,y,'r',x,y2,'b')

        

        app.InformationTextArea.Value = ({'The plot of the Beam Profile of the light coming out from the Fiber is showed. ';

            '';'Parameters used are w01 and wavelength lamda.';'';'Make sure z1 = 0 (origin is at the endface of fiber.)';'';'Data is automaticaly saved'});

        

        % Save Data from Plot

        

        p = x;    

        q = y;

        q2 = y2;

     

        T1 = [p;q;q2]';

      

      writematrix(T1,'BeamProfile_Fiber_data01.xlsx')

        

        end


        % Callback function: LGmmEditField, OnButton

        function OnButtonPushed(app, event)

        app.Image.Visible = 'on';

        

        end


        % Button pushed function: OffButton

        function OffButtonPushed(app, event)

            app.Image.Visible = 'off';

        end


        % Button pushed function: TestButton

        function TestButtonPushed(app, event)

       % if app.Image.Visible == 'on'

       % ABCD Theory

        

       % w01 = app.w01EditField.Value; % um

        L01 = app.LmmEditField.Value*1000; % um

        

        n2 = app.n2EditField.Value;

       

        R = app.RmmEditField.Value*1000; %um

        

        % Matrix Parameters

        A = 1;

        B = L01/n2;

        C = (1-n2)/R;

        D = ((L01*(1-n2))/(R*n2)) + 1;

        

        app.TestEditField.Value = (A*D) - (B*C);

        end


        % Button pushed function: CalculationButton

        function CalculationButtonPushed(app, event)

       

        % ABCD Theory

        

        w01 = app.w01EditField.Value; % um

        L01 = app.LmmEditField.Value*1000; % um

        l = app.lEditField.Value;  % um

        z1 = app.z1mmEditField.Value*1000; % um

        n2 = app.n2EditField.Value;

        gam01 = (pi*(w01)^2)/l; % um

        R = app.RmmEditField.Value*1000; %um

        

        % Matrix Parameters

        A = 1;

        B = L01/n2;

        C = (1-n2)/R;

        D = ((L01*(1-n2))/(R*n2)) + 1;

        

        % Gaussian Beam Parameters

        w02 = w01*sqrt((A*D - B*C)/((C*z1 + D)^2 + (C*gam01)^2));

        z2 = -(((A*z1 + B)*(C*z1 + D)) + A*C*gam01^2)/(((C*z1 + D)^2) + (C*gam01)^2);

        

               

         app.WDmmEditField.Value = 2*z2/1000;

         app.w02umEditField.Value = w02;

         app.z2mmEditField.Value = z2/1000;

            

         app.InformationTextArea.Value = ({'Value of the Parameters were calculated. ';'';'z2 is the position of the minimun beam waist.';'w02 is the beam waist.';'WD is the Working Distance.'; 'See Drawing''s Tab.'});

        end


        % Value changing function: z1mmSlider

        function z1mmSliderValueChanging(app, event)

            changingValue = event.Value;

            app.z1mmEditField.Value = changingValue;

            

            % ABCD Theory

        

        w01 = app.w01EditField.Value; % um

        L01 = app.LmmEditField.Value*1000; % um

        l = app.lEditField.Value;  % um

        z1 = app.z1mmEditField.Value*1000; %Value of z01 consant for now, um

        n2 = app.n2EditField.Value;

        gam01 = (pi*(w01)^2)/l; % um

        R = app.RmmEditField.Value*1000; %um

        

        % Matrix Parameters

        A = 1;

        B = L01/n2;

        C = (1-n2)/R;

        D = ((L01*(1-n2))/(R*n2)) + 1;

        

        % Gaussian Beam Parameters

        w02 = w01*sqrt((A*D - B*C)/((C*z1 + D)^2 + (C*gam01)^2));  % um

        z2 = -((A*z1 + B)*(C*z1 + D) + A*C*gam01^2)/((C*z1 + D)^2 + (C*gam01)^2);  % um

        gam02 = (pi*(w02)^2)/l; % um

           

        % Values used:

        app.w02umEditField.Value = w02;

        app.z2mmEditField.Value = z2/1000;

        app.WDmmEditField.Value = 2*z2/1000;   

            

        % Gaussian Profile

        x =  -5:0.1:45;

        y = w02*sqrt(1 + (((x*1000) - z2)/gam02).^2);

        y2 = -w02*sqrt(1 + (((x*1000) - z2)/gam02).^2);

        

        load data2.txt;

        [n,p]= size(data2);

        tt= 0:5:40;

        

        plot(app.UIAxes,x,y,'r',x,y2,'b',tt,data2,'p')

        

        app.InformationTextArea.Value = ({'Plot is changing using the values showed in "Constant''s Panel".';'';'Value of z1 is taken from z1 bar slider.'});

        end


        % Button pushed function: SavePlotCLensButton

        function SavePlotCLensButtonPushed(app, event)

                  % ABCD Theory

        

        w01 = app.w01EditField.Value; % um  

        L01 = app.LmmEditField.Value*1000; % um

        l = app.lEditField.Value;  % um

        z1 = app.z1mmEditField.Value*1000; %Value of z01 consant for now, um

        n2 = app.n2EditField.Value;

        gam01 = (pi*(w01)^2)/l; % um

        R = app.RmmEditField.Value*1000; %um

        

        % Matrix Parameters

        A = 1;

        B = L01/n2;

        C = (1-n2)/R;

        D = ((L01*(1-n2))/(R*n2)) + 1;

        

        % Gaussian Beam Parameters

        w02 = w01*sqrt((A*D - B*C)/((C*z1 + D)^2 + (C*gam01)^2));  % um

        z2 = -((A*z1 + B)*(C*z1 + D) + A*C*gam01^2)/((C*z1 + D)^2 + (C*gam01)^2);  % um

        gam02 = (pi*(w02)^2)/l; % um

           

        % Values used:

        app.w02umEditField.Value = w02;

        app.z2mmEditField.Value = z2/1000;

        app.WDmmEditField.Value = 2*z2/1000;   

            

        % Gaussian Profile

        x =  -5:0.1:45;

        y = w02*sqrt(1 + (((x*1000) - z2)/gam02).^2);

        y2 = -w02*sqrt(1 + (((x*1000) - z2)/gam02).^2);

        

        

        p = x;    

        q = y;

        q2 = y2;

        

       %p = array2table(x);

       % csvwrite('01.txt',p,q)

        

       %filename = 'testdata.xlsx';

       %A = x;

       %B = y;

       % xlswrite(filename,A,B)

      

      T1 = [p;q;q2]';

      

      writematrix(T1,'BeamProfile_CLens_data01.xlsx')

      

      

           % writetable(T,'tabledata.txt');

           %type tabledata.txt

        

           % save('BeamProfile_X.txt','p','-ascii')

           % save('BeamProfile_Y.txt','q','-ascii') 

           % type('Beamprofile.txt')

           

           app.InformationTextArea.Value = ({'Gaussian Beam Profile data was saved.';'';' Values showed in "Constant''s Panel were used".';'';'Value of z1 is taken from z1 EditField/Bar Slider.'});

        end


        % Button pushed function: PlotCLensButton

        function PlotCLensButtonPushed(app, event)

      app.z1mmSlider.Value = app.z1mmEditField.Value;

             

        w01 = app.w01EditField.Value; % um

        L01 = app.LmmEditField.Value*1000; % um

        l = app.lEditField.Value;  % um

        z1 = app.z1mmEditField.Value*1000; %Value of z01 consant for now, um

        n2 = app.n2EditField.Value;

        gam01 = (pi*(w01)^2)/l; % um

        R = app.RmmEditField.Value*1000; %um

        

        % Matrix Parameters

        A = 1;

        B = L01/n2;

        C = (1-n2)/R;

        D = ((L01*(1-n2))/(R*n2)) + 1;

        

        % Gaussian Beam Parameters

        w02 = w01*sqrt((A*D - B*C)/((C*z1 + D)^2 + (C*gam01)^2));  % um

        z2 = -((A*z1 + B)*(C*z1 + D) + A*C*gam01^2)/((C*z1 + D)^2 + (C*gam01)^2);  % um

        gam02 = (pi*(w02)^2)/l; % um

           

        % Values used:

        app.w02umEditField.Value = w02;

        app.z2mmEditField.Value = z2/1000;

        app.WDmmEditField.Value = 2*z2/1000;   

            

        % Gaussian Profile

        x =  -5:0.1:45;

        y = w02*sqrt(1 + (((x*1000) - z2)/gam02).^2);

        y2 = -w02*sqrt(1 + (((x*1000) - z2)/gam02).^2);

        

        load data2.txt;

        [n,p]= size(data2);

        tt= 0:5:40;

        

        plot(app.UIAxes,x,y,'r',x,y2,'b',tt,data2,'p')

        

        app.InformationTextArea.Value = ({'Plot is performed using the values showed in "Constant''s Panel".';'';'Value of z1 is taken from z1 EditField.'});

      

        end


        % Button pushed function: PlotFiberButton_2

        function PlotFiberButton_2Pushed(app, event)

        wG01 = app.wG01EditField.Value; % in um

        lG = app.lEditField_2.Value; % in um

        zG1 = app.zG1mmEditField.Value*1000; % Value of zG01 in um

        gamG01 = (pi*(wG01)^2)/lG;

                        

        % Gaussian Profile

        xG =  -1:0.05:3   ;

        yG = wG01*sqrt(1 + (((xG*1000) - zG1)/gamG01).^2);

        yG2 = -wG01*sqrt(1 + (((xG*1000) - zG1)/gamG01).^2);

        

        % Plot Data

        plot(app.UIAxes_2,xG,yG,'r',xG,yG2,'b')

        

        app.InformationTextArea.Value = ({'The plot of the Beam Profile of the light coming out from the Fiber is showed. ';

            '';'Parameters used are wG01 and wavelength lamda.';'';'Make sure zG1 = 0 (origin is at the endface of fiber.)';'';'Data is automaticaly saved: "BeamProfile_FiberG_data01.xlsx" ' });

        

        % Save Data from Plot

        pG = xG;    

        qG = yG;

        qG2 = yG2;

         

        TG1 = [pG;qG;qG2]';

      

        writematrix(TG1,'BeamProfile_FiberG_data01.xlsx')

        end


        % Button pushed function: PlotGLensButton

        function PlotGLensButtonPushed(app, event)

        app.zG1mmSlider.Value = app.zG1mmEditField.Value;

             

        wG01 = app.wG01EditField.Value; % um Beam radius at q0

        LG01 = app.LGmmEditField.Value*1000; % um

        lG = app.lEditField_2.Value ;  % um

        zG1 = app.zG1mmEditField.Value*1000; %Value of z01 consant for now, um

        nG2 = app.nG2EditField.Value;

        gamG01 = (pi*(wG01)^2)/lG; % um

        h = app.hmm1EditField.Value/1000; %um h is the gradient constant

        

        % Matrix ABCD

        A = cos(h*LG01);

        B = (1/(nG2*h))*sin(h*LG01);

        C = (-nG2*h)*sin(h*LG01);

        D = cos(h*LG01);

        

        % Gaussian Beam Parameters

        wG02 = wG01*sqrt((A*D - B*C)/((C*zG1 + D)^2 + (C*gamG01)^2));  % um Minimum Beam waist raidus 

        zG2 = -((A*zG1 + B)*(C*zG1 + D) + A*C*gamG01^2)/((C*zG1 + D)^2 + (C*gamG01)^2);  % um Position of Minimum Beam Waist

        gamG02 = (pi*(wG02)^2)/lG; % um Rayleigh range

           

        % Values used:

        app.wG02umEditField.Value = wG02;     % um Beam Waist radius at focus

        app.zG2mmEditField.Value = zG2/1000;  % mm Position of Beam Waist

        app.WDmmEditField_2.Value = 2*zG2/1000;  % mm Working Distance

            

        % Gaussian Profile

        xG =  -5:0.1:45;

        yG = wG02*sqrt(1 + (((xG*1000) - zG2)/gamG02).^2);

        yG2 = -wG02*sqrt(1 + (((xG*1000) - zG2)/gamG02).^2);

        

        load data2.txt;

        [n,p]= size(data2);

        tt= 0:5:40;

        

        plot(app.UIAxes_2,xG,yG,'r',xG,yG2,'b',tt,data2,'p')

        

        app.InformationTextArea.Value = ({'Plot is performed using the values showed in "G-Lens Constant''s Panel".';'';'Value of zG1 is taken from zG1 EditField.'});

          

        end


        % Value changing function: zG1mmSlider

        function zG1mmSliderValueChanging(app, event)

            changingValue = event.Value;

            

        app.zG1mmEditField.Value = changingValue;

             

        wG01 = app.wG01EditField.Value; % um Beam radius at q0

        LG01 = app.LGmmEditField.Value*1000; % um

        lG = app.lEditField_2.Value ;  % um

        zG1 = app.zG1mmEditField.Value*1000; %Value of z01 consant for now, um

        nG2 = app.nG2EditField.Value;

        gamG01 = (pi*(wG01)^2)/lG; % um

        h = app.hmm1EditField.Value/1000; %um h is the gradient constant

        

        % Matrix ABCD

        A = cos(h*LG01);

        B = (1/(nG2*h))*sin(h*LG01);

        C = (-nG2*h)*sin(h*LG01);

        D = cos(h*LG01);

        

        % Gaussian Beam Parameters

        wG02 = wG01*sqrt((A*D - B*C)/((C*zG1 + D)^2 + (C*gamG01)^2));  % um Minimum Beam waist raidus 

        zG2 = -((A*zG1 + B)*(C*zG1 + D) + A*C*gamG01^2)/((C*zG1 + D)^2 + (C*gamG01)^2);  % um Position of Minimum Beam Waist

        gamG02 = (pi*(wG02)^2)/lG; % um Rayleigh range

           

        % Values used:

        app.wG02umEditField.Value = wG02;     % um Beam Waist radius at focus

        app.zG2mmEditField.Value = zG2/1000;  % mm Position of Beam Waist

        app.WDmmEditField_2.Value = 2*zG2/1000;  % mm Working Distance

            

        % Gaussian Profile

        xG =  -5:0.1:45;

        yG = wG02*sqrt(1 + (((xG*1000) - zG2)/gamG02).^2);

        yG2 = -wG02*sqrt(1 + (((xG*1000) - zG2)/gamG02).^2);

        

        load data2.txt;

        [n,p]= size(data2);

        tt= 0:5:40;

        

        plot(app.UIAxes_2,xG,yG,'r',xG,yG2,'b',tt,data2,'p')

        

        app.InformationTextArea.Value = ({'Plot is performed using the values showed in "G-Lens Constant''s Panel".';'';'Value of zG1 is taken from zG1 EditField.'});

        end


        % Button pushed function: SavePlotGLensButton

        function SavePlotGLensButtonPushed(app, event)

           

             

        wG01 = app.wG01EditField.Value; % um Beam radius at q0

        LG01 = app.LGmmEditField.Value*1000; % um

        lG = app.lEditField_2.Value ;  % um

        zG1 = app.zG1mmEditField.Value*1000; %Value of z01 consant for now, um

        nG2 = app.nG2EditField.Value;

        gamG01 = (pi*(wG01)^2)/lG; % um

        h = app.hmm1EditField.Value/1000; %um h is the gradient constant

        

        % Matrix ABCD

        A = cos(h*LG01);

        B = (1/(nG2*h))*sin(h*LG01);

        C = (-nG2*h)*sin(h*LG01);

        D = cos(h*LG01);

        

        % Gaussian Beam Parameters

        wG02 = wG01*sqrt((A*D - B*C)/((C*zG1 + D)^2 + (C*gamG01)^2));  % um Minimum Beam waist raidus 

        zG2 = -((A*zG1 + B)*(C*zG1 + D) + A*C*gamG01^2)/((C*zG1 + D)^2 + (C*gamG01)^2);  % um Position of Minimum Beam Waist

        gamG02 = (pi*(wG02)^2)/lG; % um Rayleigh range

           

        % Values used:

        app.wG02umEditField.Value = wG02;     % um Beam Waist radius at focus

        app.zG2mmEditField.Value = zG2/1000;  % mm Position of Beam Waist

        app.WDmmEditField_2.Value = 2*zG2/1000;  % mm Working Distance

            

        % Gaussian Profile

        xG =  -5:0.1:45;

        yG = wG02*sqrt(1 + (((xG*1000) - zG2)/gamG02).^2);

        yG2 = -wG02*sqrt(1 + (((xG*1000) - zG2)/gamG02).^2);

        

        pG = xG;    

        qG = yG;

        qG2 = yG2;

     

        TG1 = [pG;qG;qG2]';

      

        writematrix(TG1,'BeamProfile_GLens_data01.xlsx')

      

      

    

        

        app.InformationTextArea.Value = ({'Gaussian Beam Profile data was saved.';'';'Values showed in "G-Lens Constant''s Panel were used".';'';'Value of zG1 is taken from zG1 EditField/Bar Slider.'});

          

        end


        % Button pushed function: CalculationButton_2

        function CalculationButton_2Pushed(app, event)

        wG01 = app.wG01EditField.Value; % um Beam radius at q0

        

        LG01 = app.LGmmEditField.Value*1000; % um

        lG = app.lEditField_2.Value ;  % um

        zG1 = app.zG1mmEditField.Value*1000; %Value of z01 consant for now, um

        nG2 = app.nG2EditField.Value;

        gamG01 = (pi*(wG01)^2)/lG; % um

        h = app.hmm1EditField.Value/1000; %um h is the gradient constant

        

        % Matrix ABCD

        A = cos(h*LG01);

        B = (1/(nG2*h))*sin(h*LG01);

        C = (-nG2*h)*sin(h*LG01);

        D = cos(h*LG01);

        

        % Gaussian Beam Parameters

        wG02 = wG01*sqrt((A*D - B*C)/((C*zG1 + D)^2 + (C*gamG01)^2));  % um Minimum Beam waist raidus 

        zG2 = -((A*zG1 + B)*(C*zG1 + D) + A*C*gamG01^2)/((C*zG1 + D)^2 + (C*gamG01)^2);  % um Position of Minimum Beam Waist

        

           

        % Values used:

        app.wG02umEditField.Value = wG02;     % um Beam Waist radius at focus

        app.zG2mmEditField.Value = zG2/1000;  % mm Position of Beam Waist

        app.WDmmEditField_2.Value = 2*zG2/1000;  % mm Working Distance

            

    

        app.InformationTextArea.Value = ({'Value of the Parameters were calculated. ';'';'zG2 is the position of the minimun beam waist.';'wG02 is the beam waist raidus.';'WD is the Working Distance.'; 'See Drawing''s Tab.'});  

        end


        % Size changed function: GLensTab

        function GLensTabSizeChanged(app, event)

            position = app.GLensTab.Position;

            app.TabGroup.SelectedTab = app.InputsTab;

                

                app.TestEditField.Value = 3;

      

        end

    end


    % Component initialization

    methods (Access = private)


        % Create UIFigure and components

        function createComponents(app)


            % Create UIFigure and hide until all components are created

            app.UIFigure = uifigure('Visible', 'off');

            app.UIFigure.Position = [100 100 984 527];

            app.UIFigure.Name = 'UI Figure';


            % Create TabGroup

            app.TabGroup = uitabgroup(app.UIFigure);

            app.TabGroup.Position = [1 11 704 517];


            % Create CLensTab

            app.CLensTab = uitab(app.TabGroup);

            app.CLensTab.Title = 'C-Lens';


            % Create CLensConstants1550nmPanel

            app.CLensConstants1550nmPanel = uipanel(app.CLensTab);

            app.CLensConstants1550nmPanel.Title = 'C-Lens Constants (@1550nm):';

            app.CLensConstants1550nmPanel.FontWeight = 'bold';

            app.CLensConstants1550nmPanel.Position = [20 377 362 99];


            % Create lEditFieldLabel

            app.lEditFieldLabel = uilabel(app.CLensConstants1550nmPanel);

            app.lEditFieldLabel.HorizontalAlignment = 'right';

            app.lEditFieldLabel.FontName = 'Symbol';

            app.lEditFieldLabel.FontSize = 15;

            app.lEditFieldLabel.FontWeight = 'bold';

            app.lEditFieldLabel.Position = [11 11 17 22];

            app.lEditFieldLabel.Text = 'l ';


            % Create lEditField

            app.lEditField = uieditfield(app.CLensConstants1550nmPanel, 'numeric');

            app.lEditField.ValueDisplayFormat = '%.3f';

            app.lEditField.Position = [71 10 42 22];

            app.lEditField.Value = 1.26;


            % Create lEditFieldLabel_2

            app.lEditFieldLabel_2 = uilabel(app.CLensConstants1550nmPanel);

            app.lEditFieldLabel_2.HorizontalAlignment = 'right';

            app.lEditFieldLabel_2.FontName = 'Times New Roman';

            app.lEditFieldLabel_2.FontSize = 15;

            app.lEditFieldLabel_2.FontWeight = 'bold';

            app.lEditFieldLabel_2.Position = [21 10 36 22];

            app.lEditFieldLabel_2.Text = '(um)';


            % Create lEditFieldLabel_3

            app.lEditFieldLabel_3 = uilabel(app.CLensConstants1550nmPanel);

            app.lEditFieldLabel_3.HorizontalAlignment = 'right';

            app.lEditFieldLabel_3.FontName = 'Times New Roman';

            app.lEditFieldLabel_3.FontSize = 15;

            app.lEditFieldLabel_3.FontWeight = 'bold';

            app.lEditFieldLabel_3.Position = [27 54 36 22];

            app.lEditFieldLabel_3.Text = '(um)';


            % Create w01EditFieldLabel

            app.w01EditFieldLabel = uilabel(app.CLensConstants1550nmPanel);

            app.w01EditFieldLabel.HorizontalAlignment = 'right';

            app.w01EditFieldLabel.FontName = 'Symbol';

            app.w01EditFieldLabel.FontSize = 15;

            app.w01EditFieldLabel.FontWeight = 'bold';

            app.w01EditFieldLabel.Position = [-2 54 32 22];

            app.w01EditFieldLabel.Text = 'w01';


            % Create w01EditField

            app.w01EditField = uieditfield(app.CLensConstants1550nmPanel, 'numeric');

            app.w01EditField.ValueDisplayFormat = '%.3f';

            app.w01EditField.Position = [69 53 44 22];

            app.w01EditField.Value = 4.475;


            % Create n1EditFieldLabel

            app.n1EditFieldLabel = uilabel(app.CLensConstants1550nmPanel);

            app.n1EditFieldLabel.HorizontalAlignment = 'right';

            app.n1EditFieldLabel.FontSize = 13;

            app.n1EditFieldLabel.FontWeight = 'bold';

            app.n1EditFieldLabel.Position = [132 54 25 22];

            app.n1EditFieldLabel.Text = 'n1';


            % Create n1EditField

            app.n1EditField = uieditfield(app.CLensConstants1550nmPanel, 'numeric');

            app.n1EditField.ValueDisplayFormat = '%.3f';

            app.n1EditField.Position = [172 54 46 22];

            app.n1EditField.Value = 1;


            % Create n2EditFieldLabel

            app.n2EditFieldLabel = uilabel(app.CLensConstants1550nmPanel);

            app.n2EditFieldLabel.HorizontalAlignment = 'right';

            app.n2EditFieldLabel.FontSize = 13;

            app.n2EditFieldLabel.FontWeight = 'bold';

            app.n2EditFieldLabel.Position = [124 10 25 22];

            app.n2EditFieldLabel.Text = 'n2';


            % Create n2EditField

            app.n2EditField = uieditfield(app.CLensConstants1550nmPanel, 'numeric');

            app.n2EditField.ValueDisplayFormat = '%.3f';

            app.n2EditField.Position = [164 10 54 22];

            app.n2EditField.Value = 1.7447;


            % Create LmmEditFieldLabel

            app.LmmEditFieldLabel = uilabel(app.CLensConstants1550nmPanel);

            app.LmmEditFieldLabel.HorizontalAlignment = 'right';

            app.LmmEditFieldLabel.FontSize = 13;

            app.LmmEditFieldLabel.FontWeight = 'bold';

            app.LmmEditFieldLabel.Position = [233 54 48 22];

            app.LmmEditFieldLabel.Text = 'L (mm)';


            % Create LmmEditField

            app.LmmEditField = uieditfield(app.CLensConstants1550nmPanel, 'numeric');

            app.LmmEditField.ValueDisplayFormat = '%.3f';

            app.LmmEditField.Position = [296 54 45 22];

            app.LmmEditField.Value = 2.62;


            % Create RmmEditFieldLabel

            app.RmmEditFieldLabel = uilabel(app.CLensConstants1550nmPanel);

            app.RmmEditFieldLabel.HorizontalAlignment = 'right';

            app.RmmEditFieldLabel.FontSize = 13;

            app.RmmEditFieldLabel.FontWeight = 'bold';

            app.RmmEditFieldLabel.Position = [232 10 50 22];

            app.RmmEditFieldLabel.Text = 'R (mm)';


            % Create RmmEditField

            app.RmmEditField = uieditfield(app.CLensConstants1550nmPanel, 'numeric');

            app.RmmEditField.ValueDisplayFormat = '%.3f';

            app.RmmEditField.Position = [296 10 45 22];

            app.RmmEditField.Value = 1.2;


            % Create UIAxes

            app.UIAxes = uiaxes(app.CLensTab);

            title(app.UIAxes, 'w(z) = w0 Sqrt [1 + {((z-z2)/z0)}^2]')

            xlabel(app.UIAxes, 'Z2 (mm)')

            ylabel(app.UIAxes, 'Y (um)')

            app.UIAxes.PlotBoxAspectRatio = [2.45652173913043 1 1];

            app.UIAxes.Position = [20 30 508 264];


            % Create PlotFiberButton

            app.PlotFiberButton = uibutton(app.CLensTab, 'push');

            app.PlotFiberButton.ButtonPushedFcn = createCallbackFcn(app, @PlotFiberButtonPushed, true);

            app.PlotFiberButton.Position = [77 9 100 22];

            app.PlotFiberButton.Text = 'Plot (Fiber)';


            % Create GaussianBeamProfileLabel

            app.GaussianBeamProfileLabel = uilabel(app.CLensTab);

            app.GaussianBeamProfileLabel.FontSize = 17;

            app.GaussianBeamProfileLabel.FontWeight = 'bold';

            app.GaussianBeamProfileLabel.Position = [192 279 191 22];

            app.GaussianBeamProfileLabel.Text = 'Gaussian Beam Profile';


            % Create ParametersPanel

            app.ParametersPanel = uipanel(app.CLensTab);

            app.ParametersPanel.Title = 'Parameters:';

            app.ParametersPanel.FontWeight = 'bold';

            app.ParametersPanel.Position = [413 342 290 134];


            % Create z2mmEditFieldLabel

            app.z2mmEditFieldLabel = uilabel(app.ParametersPanel);

            app.z2mmEditFieldLabel.HorizontalAlignment = 'right';

            app.z2mmEditFieldLabel.FontSize = 13;

            app.z2mmEditFieldLabel.FontWeight = 'bold';

            app.z2mmEditFieldLabel.Position = [15 89 59 22];

            app.z2mmEditFieldLabel.Text = 'z2 (mm):';


            % Create z2mmEditField

            app.z2mmEditField = uieditfield(app.ParametersPanel, 'numeric');

            app.z2mmEditField.ValueDisplayFormat = '%.3f';

            app.z2mmEditField.Position = [80 89 59 22];


            % Create w02umEditFieldLabel

            app.w02umEditFieldLabel = uilabel(app.ParametersPanel);

            app.w02umEditFieldLabel.HorizontalAlignment = 'right';

            app.w02umEditFieldLabel.FontSize = 13;

            app.w02umEditFieldLabel.FontWeight = 'bold';

            app.w02umEditFieldLabel.Position = [6 45 66 22];

            app.w02umEditFieldLabel.Text = 'w02 (um):';


            % Create w02umEditField

            app.w02umEditField = uieditfield(app.ParametersPanel, 'numeric');

            app.w02umEditField.ValueDisplayFormat = '%.3f';

            app.w02umEditField.Position = [80 45 60 22];


            % Create WDmmEditFieldLabel

            app.WDmmEditFieldLabel = uilabel(app.ParametersPanel);

            app.WDmmEditFieldLabel.HorizontalAlignment = 'right';

            app.WDmmEditFieldLabel.FontSize = 13;

            app.WDmmEditFieldLabel.FontWeight = 'bold';

            app.WDmmEditFieldLabel.Position = [153 88 62 22];

            app.WDmmEditFieldLabel.Text = 'WD (mm)';


            % Create WDmmEditField

            app.WDmmEditField = uieditfield(app.ParametersPanel, 'numeric');

            app.WDmmEditField.ValueDisplayFormat = '%.3f';

            app.WDmmEditField.Position = [223 88 59 22];


            % Create CalculationButton

            app.CalculationButton = uibutton(app.CLensTab, 'push');

            app.CalculationButton.ButtonPushedFcn = createCallbackFcn(app, @CalculationButtonPushed, true);

            app.CalculationButton.Position = [519 312 100 22];

            app.CalculationButton.Text = 'Calculation';


            % Create z1mmSliderLabel

            app.z1mmSliderLabel = uilabel(app.CLensTab);

            app.z1mmSliderLabel.HorizontalAlignment = 'right';

            app.z1mmSliderLabel.FontSize = 13;

            app.z1mmSliderLabel.FontWeight = 'bold';

            app.z1mmSliderLabel.Position = [25 342 54 22];

            app.z1mmSliderLabel.Text = 'z1 (mm)';


            % Create z1mmSlider

            app.z1mmSlider = uislider(app.CLensTab);

            app.z1mmSlider.Limits = [0 1];

            app.z1mmSlider.ValueChangingFcn = createCallbackFcn(app, @z1mmSliderValueChanging, true);

            app.z1mmSlider.Position = [100 351 150 3];


            % Create z1mmEditFieldLabel

            app.z1mmEditFieldLabel = uilabel(app.CLensTab);

            app.z1mmEditFieldLabel.HorizontalAlignment = 'right';

            app.z1mmEditFieldLabel.FontSize = 13;

            app.z1mmEditFieldLabel.FontWeight = 'bold';

            app.z1mmEditFieldLabel.Position = [273 341 54 22];

            app.z1mmEditFieldLabel.Text = 'z1 (mm)';


            % Create z1mmEditField

            app.z1mmEditField = uieditfield(app.CLensTab, 'numeric');

            app.z1mmEditField.ValueDisplayFormat = '%.3f';

            app.z1mmEditField.Position = [342 341 40 22];


            % Create SavePlotCLensButton

            app.SavePlotCLensButton = uibutton(app.CLensTab, 'push');

            app.SavePlotCLensButton.ButtonPushedFcn = createCallbackFcn(app, @SavePlotCLensButtonPushed, true);

            app.SavePlotCLensButton.Position = [378.5 9 117 22];

            app.SavePlotCLensButton.Text = 'Save Plot (C-Lens)';


            % Create PlotCLensButton

            app.PlotCLensButton = uibutton(app.CLensTab, 'push');

            app.PlotCLensButton.ButtonPushedFcn = createCallbackFcn(app, @PlotCLensButtonPushed, true);

            app.PlotCLensButton.Position = [201 9 100 22];

            app.PlotCLensButton.Text = 'Plot (C-Lens)';


            % Create GLensTab

            app.GLensTab = uitab(app.TabGroup);

            app.GLensTab.SizeChangedFcn = createCallbackFcn(app, @GLensTabSizeChanged, true);

            app.GLensTab.Title = 'G-Lens';


            % Create GLensConstants1550nmPanel

            app.GLensConstants1550nmPanel = uipanel(app.GLensTab);

            app.GLensConstants1550nmPanel.Title = 'G-Lens Constants (@1550nm):';

            app.GLensConstants1550nmPanel.FontWeight = 'bold';

            app.GLensConstants1550nmPanel.Position = [20 377 362 99];


            % Create lEditField_2Label

            app.lEditField_2Label = uilabel(app.GLensConstants1550nmPanel);

            app.lEditField_2Label.HorizontalAlignment = 'right';

            app.lEditField_2Label.FontName = 'Symbol';

            app.lEditField_2Label.FontSize = 15;

            app.lEditField_2Label.FontWeight = 'bold';

            app.lEditField_2Label.Position = [10 11 17 22];

            app.lEditField_2Label.Text = 'l ';


            % Create lEditField_2

            app.lEditField_2 = uieditfield(app.GLensConstants1550nmPanel, 'numeric');

            app.lEditField_2.ValueDisplayFormat = '%.3f';

            app.lEditField_2.Position = [71 10 42 22];

            app.lEditField_2.Value = 1.26;


            % Create lEditFieldLabel_4

            app.lEditFieldLabel_4 = uilabel(app.GLensConstants1550nmPanel);

            app.lEditFieldLabel_4.HorizontalAlignment = 'right';

            app.lEditFieldLabel_4.FontName = 'Times New Roman';

            app.lEditFieldLabel_4.FontSize = 15;

            app.lEditFieldLabel_4.FontWeight = 'bold';

            app.lEditFieldLabel_4.Position = [21 10 36 22];

            app.lEditFieldLabel_4.Text = '(um)';


            % Create lEditFieldLabel_5

            app.lEditFieldLabel_5 = uilabel(app.GLensConstants1550nmPanel);

            app.lEditFieldLabel_5.HorizontalAlignment = 'right';

            app.lEditFieldLabel_5.FontName = 'Times New Roman';

            app.lEditFieldLabel_5.FontSize = 15;

            app.lEditFieldLabel_5.FontWeight = 'bold';

            app.lEditFieldLabel_5.Position = [44 54 36 22];

            app.lEditFieldLabel_5.Text = '(um)';


            % Create wG01EditFieldLabel

            app.wG01EditFieldLabel = uilabel(app.GLensConstants1550nmPanel);

            app.wG01EditFieldLabel.HorizontalAlignment = 'right';

            app.wG01EditFieldLabel.FontSize = 13;

            app.wG01EditFieldLabel.FontWeight = 'bold';

            app.wG01EditFieldLabel.Position = [1 53 40 22];

            app.wG01EditFieldLabel.Text = 'wG01';


            % Create wG01EditField

            app.wG01EditField = uieditfield(app.GLensConstants1550nmPanel, 'numeric');

            app.wG01EditField.ValueDisplayFormat = '%.3f';

            app.wG01EditField.Position = [86 52 43 22];

            app.wG01EditField.Value = 4.475;


            % Create n1EditField_2Label

            app.n1EditField_2Label = uilabel(app.GLensConstants1550nmPanel);

            app.n1EditField_2Label.HorizontalAlignment = 'right';

            app.n1EditField_2Label.FontSize = 13;

            app.n1EditField_2Label.FontWeight = 'bold';

            app.n1EditField_2Label.Position = [132 54 25 22];

            app.n1EditField_2Label.Text = 'n1';


            % Create n1EditField_2

            app.n1EditField_2 = uieditfield(app.GLensConstants1550nmPanel, 'numeric');

            app.n1EditField_2.ValueDisplayFormat = '%.3f';

            app.n1EditField_2.Position = [172 54 46 22];

            app.n1EditField_2.Value = 1;


            % Create nG2EditFieldLabel

            app.nG2EditFieldLabel = uilabel(app.GLensConstants1550nmPanel);

            app.nG2EditFieldLabel.HorizontalAlignment = 'right';

            app.nG2EditFieldLabel.FontSize = 13;

            app.nG2EditFieldLabel.FontWeight = 'bold';

            app.nG2EditFieldLabel.Position = [127 10 30 22];

            app.nG2EditFieldLabel.Text = 'nG2';


            % Create nG2EditField

            app.nG2EditField = uieditfield(app.GLensConstants1550nmPanel, 'numeric');

            app.nG2EditField.ValueDisplayFormat = '%.3f';

            app.nG2EditField.Position = [172 10 46 22];

            app.nG2EditField.Value = 1.6073;


            % Create LGmmEditFieldLabel

            app.LGmmEditFieldLabel = uilabel(app.GLensConstants1550nmPanel);

            app.LGmmEditFieldLabel.HorizontalAlignment = 'right';

            app.LGmmEditFieldLabel.FontSize = 13;

            app.LGmmEditFieldLabel.FontWeight = 'bold';

            app.LGmmEditFieldLabel.Position = [235 54 59 22];

            app.LGmmEditFieldLabel.Text = 'LG (mm)';


            % Create LGmmEditField

            app.LGmmEditField = uieditfield(app.GLensConstants1550nmPanel, 'numeric');

            app.LGmmEditField.ValueDisplayFormat = '%.3f';

            app.LGmmEditField.ValueChangedFcn = createCallbackFcn(app, @OnButtonPushed, true);

            app.LGmmEditField.Position = [309 54 45 22];

            app.LGmmEditField.Value = 4.26;


            % Create hmm1EditFieldLabel

            app.hmm1EditFieldLabel = uilabel(app.GLensConstants1550nmPanel);

            app.hmm1EditFieldLabel.HorizontalAlignment = 'right';

            app.hmm1EditFieldLabel.FontSize = 13;

            app.hmm1EditFieldLabel.FontWeight = 'bold';

            app.hmm1EditFieldLabel.Position = [235 10 60 22];

            app.hmm1EditFieldLabel.Text = 'h (mm-1)';


            % Create hmm1EditField

            app.hmm1EditField = uieditfield(app.GLensConstants1550nmPanel, 'numeric');

            app.hmm1EditField.ValueDisplayFormat = '%.3f';

            app.hmm1EditField.Position = [309 10 45 22];

            app.hmm1EditField.Value = 0.339;


            % Create UIAxes_2

            app.UIAxes_2 = uiaxes(app.GLensTab);

            title(app.UIAxes_2, 'w(z) = w0 Sqrt [1 + {((z-z2)/z0)}^2]')

            xlabel(app.UIAxes_2, 'ZG2 (mm)')

            ylabel(app.UIAxes_2, 'Y (um)')

            app.UIAxes_2.PlotBoxAspectRatio = [2.45652173913043 1 1];

            app.UIAxes_2.Position = [20 30 508 264];


            % Create PlotFiberButton_2

            app.PlotFiberButton_2 = uibutton(app.GLensTab, 'push');

            app.PlotFiberButton_2.ButtonPushedFcn = createCallbackFcn(app, @PlotFiberButton_2Pushed, true);

            app.PlotFiberButton_2.Position = [77 9 100 22];

            app.PlotFiberButton_2.Text = 'Plot (Fiber)';


            % Create GaussianBeamProfileLabel_2

            app.GaussianBeamProfileLabel_2 = uilabel(app.GLensTab);

            app.GaussianBeamProfileLabel_2.FontSize = 17;

            app.GaussianBeamProfileLabel_2.FontWeight = 'bold';

            app.GaussianBeamProfileLabel_2.Position = [197 279 191 22];

            app.GaussianBeamProfileLabel_2.Text = 'Gaussian Beam Profile';


            % Create ParametersPanel_2

            app.ParametersPanel_2 = uipanel(app.GLensTab);

            app.ParametersPanel_2.Title = 'Parameters:';

            app.ParametersPanel_2.FontWeight = 'bold';

            app.ParametersPanel_2.Position = [413 342 290 134];


            % Create zG2mmEditFieldLabel

            app.zG2mmEditFieldLabel = uilabel(app.ParametersPanel_2);

            app.zG2mmEditFieldLabel.HorizontalAlignment = 'right';

            app.zG2mmEditFieldLabel.FontSize = 13;

            app.zG2mmEditFieldLabel.FontWeight = 'bold';

            app.zG2mmEditFieldLabel.Position = [5 89 69 22];

            app.zG2mmEditFieldLabel.Text = 'zG2 (mm):';


            % Create zG2mmEditField

            app.zG2mmEditField = uieditfield(app.ParametersPanel_2, 'numeric');

            app.zG2mmEditField.ValueDisplayFormat = '%.3f';

            app.zG2mmEditField.Position = [80 89 59 22];


            % Create wG02umEditFieldLabel

            app.wG02umEditFieldLabel = uilabel(app.ParametersPanel_2);

            app.wG02umEditFieldLabel.HorizontalAlignment = 'right';

            app.wG02umEditFieldLabel.FontSize = 13;

            app.wG02umEditFieldLabel.FontWeight = 'bold';

            app.wG02umEditFieldLabel.Position = [0 45 76 22];

            app.wG02umEditFieldLabel.Text = 'wG02 (um):';


            % Create wG02umEditField

            app.wG02umEditField = uieditfield(app.ParametersPanel_2, 'numeric');

            app.wG02umEditField.ValueDisplayFormat = '%.3f';

            app.wG02umEditField.Position = [80 45 60 22];


            % Create WDmmEditField_2Label

            app.WDmmEditField_2Label = uilabel(app.ParametersPanel_2);

            app.WDmmEditField_2Label.HorizontalAlignment = 'right';

            app.WDmmEditField_2Label.FontSize = 13;

            app.WDmmEditField_2Label.FontWeight = 'bold';

            app.WDmmEditField_2Label.Position = [153 88 62 22];

            app.WDmmEditField_2Label.Text = 'WD (mm)';


            % Create WDmmEditField_2

            app.WDmmEditField_2 = uieditfield(app.ParametersPanel_2, 'numeric');

            app.WDmmEditField_2.ValueDisplayFormat = '%.3f';

            app.WDmmEditField_2.Position = [223 88 59 22];


            % Create CalculationButton_2

            app.CalculationButton_2 = uibutton(app.GLensTab, 'push');

            app.CalculationButton_2.ButtonPushedFcn = createCallbackFcn(app, @CalculationButton_2Pushed, true);

            app.CalculationButton_2.Position = [519 312 100 22];

            app.CalculationButton_2.Text = 'Calculation';


            % Create zG1mmSliderLabel

            app.zG1mmSliderLabel = uilabel(app.GLensTab);

            app.zG1mmSliderLabel.HorizontalAlignment = 'right';

            app.zG1mmSliderLabel.FontSize = 13;

            app.zG1mmSliderLabel.FontWeight = 'bold';

            app.zG1mmSliderLabel.Position = [15 342 64 22];

            app.zG1mmSliderLabel.Text = 'zG1 (mm)';


            % Create zG1mmSlider

            app.zG1mmSlider = uislider(app.GLensTab);

            app.zG1mmSlider.Limits = [0 1];

            app.zG1mmSlider.ValueChangingFcn = createCallbackFcn(app, @zG1mmSliderValueChanging, true);

            app.zG1mmSlider.Position = [100 351 150 3];


            % Create zG1mmEditFieldLabel

            app.zG1mmEditFieldLabel = uilabel(app.GLensTab);

            app.zG1mmEditFieldLabel.HorizontalAlignment = 'right';

            app.zG1mmEditFieldLabel.FontSize = 13;

            app.zG1mmEditFieldLabel.FontWeight = 'bold';

            app.zG1mmEditFieldLabel.Position = [263 341 64 22];

            app.zG1mmEditFieldLabel.Text = 'zG1 (mm)';


            % Create zG1mmEditField

            app.zG1mmEditField = uieditfield(app.GLensTab, 'numeric');

            app.zG1mmEditField.ValueDisplayFormat = '%.3f';

            app.zG1mmEditField.Position = [342 341 40 22];


            % Create SavePlotGLensButton

            app.SavePlotGLensButton = uibutton(app.GLensTab, 'push');

            app.SavePlotGLensButton.ButtonPushedFcn = createCallbackFcn(app, @SavePlotGLensButtonPushed, true);

            app.SavePlotGLensButton.Position = [378 9 118 22];

            app.SavePlotGLensButton.Text = 'Save Plot (G-Lens)';


            % Create PlotGLensButton

            app.PlotGLensButton = uibutton(app.GLensTab, 'push');

            app.PlotGLensButton.ButtonPushedFcn = createCallbackFcn(app, @PlotGLensButtonPushed, true);

            app.PlotGLensButton.Position = [192 9 100 22];

            app.PlotGLensButton.Text = 'Plot (G-Lens)';


            % Create EquationsCLensTab

            app.EquationsCLensTab = uitab(app.TabGroup);

            app.EquationsCLensTab.Title = 'Equations (C-Lens)';


            % Create Image3

            app.Image3 = uiimage(app.EquationsCLensTab);

            app.Image3.Position = [1 46 449 281];

            app.Image3.ImageSource = '07b.png';


            % Create Image4

            app.Image4 = uiimage(app.EquationsCLensTab);

            app.Image4.Position = [184 273 352 210];

            app.Image4.ImageSource = '08.png';


            % Create DrawingsCLensTab

            app.DrawingsCLensTab = uitab(app.TabGroup);

            app.DrawingsCLensTab.Title = 'Drawings (C-Lens)';


            % Create Image

            app.Image = uiimage(app.DrawingsCLensTab);

            app.Image.Position = [11 304 529 177];

            app.Image.ImageSource = '04.png';


            % Create Image2

            app.Image2 = uiimage(app.DrawingsCLensTab);

            app.Image2.Position = [11 9 493 287];

            app.Image2.ImageSource = '06.png';


            % Create Image5

            app.Image5 = uiimage(app.DrawingsCLensTab);

            app.Image5.Position = [469 1 234 332];

            app.Image5.ImageSource = '10.png';


            % Create DrawingsGLensTab

            app.DrawingsGLensTab = uitab(app.TabGroup);

            app.DrawingsGLensTab.Title = 'Drawings G-Lens';


            % Create Image8

            app.Image8 = uiimage(app.DrawingsGLensTab);

            app.Image8.Position = [1 22 702 449];

            app.Image8.ImageSource = 'G-03b.png';


            % Create OffButton

            app.OffButton = uibutton(app.UIFigure, 'push');

            app.OffButton.ButtonPushedFcn = createCallbackFcn(app, @OffButtonPushed, true);

            app.OffButton.Position = [717 344 31 22];

            app.OffButton.Text = 'Off';


            % Create OnButton

            app.OnButton = uibutton(app.UIFigure, 'push');

            app.OnButton.ButtonPushedFcn = createCallbackFcn(app, @OnButtonPushed, true);

            app.OnButton.Position = [758 344 30 22];

            app.OnButton.Text = 'On';


            % Create TestButton

            app.TestButton = uibutton(app.UIFigure, 'push');

            app.TestButton.ButtonPushedFcn = createCallbackFcn(app, @TestButtonPushed, true);

            app.TestButton.Position = [914 343 54 22];

            app.TestButton.Text = 'Test';


            % Create TestEditFieldLabel

            app.TestEditFieldLabel = uilabel(app.UIFigure);

            app.TestEditFieldLabel.HorizontalAlignment = 'right';

            app.TestEditFieldLabel.Position = [804 344 28 22];

            app.TestEditFieldLabel.Text = 'Test';


            % Create TestEditField

            app.TestEditField = uieditfield(app.UIFigure, 'numeric');

            app.TestEditField.Position = [847 344 44 22];

            app.TestEditField.Value = 2;


            % Create InformationTextAreaLabel

            app.InformationTextAreaLabel = uilabel(app.UIFigure);

            app.InformationTextAreaLabel.HorizontalAlignment = 'right';

            app.InformationTextAreaLabel.FontSize = 15;

            app.InformationTextAreaLabel.FontWeight = 'bold';

            app.InformationTextAreaLabel.Position = [717 501 88 22];

            app.InformationTextAreaLabel.Text = 'Information';


            % Create InformationTextArea

            app.InformationTextArea = uitextarea(app.UIFigure);

            app.InformationTextArea.Position = [717 373 251 117];

            app.InformationTextArea.Value = {'When you push a botton the information about that acction will be displayed here.'};


            % Create Image6

            app.Image6 = uiimage(app.UIFigure);

            app.Image6.Position = [717 104 251 129];

            app.Image6.ImageSource = 'BeamProf03.jpg';


            % Create Image7

            app.Image7 = uiimage(app.UIFigure);

            app.Image7.Position = [717 232 164 112];

            app.Image7.ImageSource = 'Fiber04.jpg';


            % Create Image9

            app.Image9 = uiimage(app.UIFigure);

            app.Image9.Position = [717 20 251 94];

            app.Image9.ImageSource = 'BeamGlensProf01.jpg';


            % Show the figure after all components are created

            app.UIFigure.Visible = 'on';

        end

    end


    % App creation and deletion

    methods (Access = public)


        % Construct app

        function app = Collimator_01


            % Create UIFigure and components

            createComponents(app)


            % Register the app with App Designer

            registerApp(app, app.UIFigure)


            if nargout == 0

                clear app

            end

        end


        % Code that executes before app deletion

        function delete(app)


            % Delete UIFigure when app is deleted

            delete(app.UIFigure)

        end

    end

end

---------------------------------------------------------------------------------------------------------------------------

Fin de Código



Conclusión



En este artículo quedan pendientes muchos términos que serán explorados más adelante, como lo son los Multiplexores, C-lens, G-lens, colimadores, fibra óptica, etc., todos ellos muy importantes en el mundo de las telecomunicaciones y tecnología a base de fibra óptica.
Respecto al software aquí desarrollado, pronto pondré un video explicativo pero puedes dejar en los comentarios tus dudas al respecto.

No hay comentarios.:

Publicar un comentario