0% found this document useful (0 votes)
41 views10 pages

'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'

This document contains code for a GUI application with multiple pages. Page 1 displays options to select team members or the director. Page 2 contains code for a fiber optics geometry page with inputs and calculations for angles of refraction. Page 3 contains code for a fiber optic attenuation page with inputs to calculate attenuation in dB. The code includes functions for callbacks and outputs between GUI elements and pages.

Uploaded by

ricardo jimenez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views10 pages

'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'

This document contains code for a GUI application with multiple pages. Page 1 displays options to select team members or the director. Page 2 contains code for a fiber optics geometry page with inputs and calculations for angles of refraction. Page 3 contains code for a fiber optic attenuation page with inputs to calculate attenuation in dB. The code includes functions for callbacks and outputs between GUI elements and pages.

Uploaded by

ricardo jimenez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

%% pagina de presentación

function varargout = PAG1(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @PAG1_OpeningFcn, ...
'gui_OutputFcn', @PAG1_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end

function PAG1_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;

guidata(hObject, handles);

function varargout = PAG1_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function listbox1_Callback(hObject, eventdata, handles)


contenido=get(hObject,'String');
a = get(hObject,'value');
opc=contenido(a);
switch cell2mat(opc)
case 'INTEGRANTES'
t=sprintf('Ricardo Andres Jimenez Guzman--1161328\nArled David
Chona Lindarte--1161307');

case 'DIRECTOR(A)'
t=sprintf('Ingeniera Karla Puerto');

end
set(handles.text2,'String',t)

function listbox1_CreateFcn(hObject, eventdata, handles)


if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function popupmenu1_Callback(hObject, eventdata, handles)


contenido9=get(hObject,'String');
guzman = get(hObject,'value');
opcion8=contenido9(guzman);

switch cell2mat(opcion8)

case 'GEOMETRIA OPTICA'


close(PAG1);
fibra

case 'ATENUACION EN TRASMISION DE FIBRA OPTICA'


close(PAG1);
PAG2

end

function popupmenu1_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function axes4_CreateFcn(hObject, eventdata, handles)


img = imread('logoufps.png');
image(img)
axis off

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

%% pagina 2 ( geometría optica )

function varargout = fibra(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fibra_OpeningFcn, ...
'gui_OutputFcn', @fibra_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end

function fibra_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;

guidata(hObject, handles);

function varargout = fibra_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function edit1_Callback(hObject, eventdata, handles)


global n11;
n11 = str2double(get(hObject,'String'))

function edit1_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function popupmenu2_Callback(hObject, eventdata, handles)


contenido=get(hObject,'String');
andres = get(hObject,'value');
opc=contenido(andres);

switch cell2mat(opc)

case 'vidrio de cuarzo'


t=sprintf('1.46');

case 'hielo'
t=sprintf('1.32');

case 'acido borico'


t=sprintf('1.463');

case 'bromo'
t=sprintf('1.654');

case 'alcohol etilico'


t=sprintf('1.361');

case 'diamante'
t=sprintf('2.417');

end
set(handles.text30,'String',t)

function popupmenu2_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit3_Callback(hObject, eventdata, handles)


global n22;
n22 = str2double(get(hObject,'String'))

function edit3_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit2_Callback(hObject, eventdata, handles)


global cambio1;
x1 = str2double(get(hObject,'String'))
cambio1 = x1*(pi/180);

function edit2_CreateFcn(hObject, eventdata, handles)


if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function popupmenu5_Callback(hObject, eventdata, handles)


contenido2=get(hObject,'String');
gisell = get(hObject,'value');
opc2=contenido2(gisell);

switch cell2mat(opc2)

case 'vidrio de cuarzo'

t2=sprintf('1.46');

case 'hielo'
t2=sprintf('1.32');

case 'acido borico'


t2=sprintf('1.463');

case 'bromo'
t2=sprintf('1.654');

case 'alcohol etilico'


t2=sprintf('1.361');

case 'diamante'
t2=sprintf('2.417');

end
set(handles.text31,'String',t2)

function popupmenu5_CreateFcn(hObject, eventdata, handles)


if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit9_Callback(hObject, eventdata, handles)


global cambio2;
x2 = str2double(get(hObject,'String'))
cambio2 = x2*(pi/180);
function edit9_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function pushbutton2_Callback(hObject, eventdata, handles)


close(fibra);
PAG1
function pushbutton3_Callback(hObject, eventdata, handles)
global n11;
global n22;
global cambio1;
calteta2 = asin((n11/n22)*sin(cambio1))
conversion1 = rad2deg(calteta2)
set(handles.text12,'String',conversion1)

function pushbutton4_Callback(hObject, eventdata, handles)


global n11;
global n22;
global cambio2;
calteta1 = asin((n22/n11)*sin(cambio2))
conversion2 = rad2deg(calteta1)
set(handles.text15,'String',conversion2)

function text31_CreateFcn(hObject, eventdata, handles)


function text30_CreateFcn(hObject, eventdata, handles)

function pushbutton5_Callback(hObject, eventdata, handles)


close(fibra);
fibra

%% pagina 3 ( atenuación de fibra optica )


function varargout = PAG2(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @PAG2_OpeningFcn, ...
'gui_OutputFcn', @PAG2_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end

function PAG2_OpeningFcn(hObject, eventdata, handles, varargin)


handles.output = hObject;

guidata(hObject, handles);

function varargout = PAG2_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function pushbutton1_Callback(hObject, eventdata, handles)


close(PAG2);
PAG1

function edit1_Callback(hObject, eventdata, handles)

function edit1_CreateFcn(hObject, eventdata, handles)


if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit2_Callback(hObject, eventdata, handles)


global p2;
p2 = str2double(get(hObject,'String'))

function edit2_CreateFcn(hObject, eventdata, handles)


if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit3_Callback(hObject, eventdata, handles)


global p3;
p3 = str2double(get(hObject,'String'))

function edit3_CreateFcn(hObject, eventdata, handles)


if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit4_Callback(hObject, eventdata, handles)


global p4;
p4 = str2double(get(hObject,'String'))

function edit4_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit5_Callback(hObject, eventdata, handles)


global p5;
p5 = str2double(get(hObject,'String'))

function edit5_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit6_Callback(hObject, eventdata, handles)


global p6;
p6 = str2double(get(hObject,'String'))

function edit6_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit7_Callback(hObject, eventdata, handles)


global p7;
p7 = str2double(get(hObject,'String'))
function edit7_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function popupmenu1_Callback(hObject, eventdata, handles)


contenido3=get(hObject,'String');
CALCULOS = get(hObject,'value');
opcion3=contenido3(CALCULOS);
global p2;
global p3;
global p4;
global p5;
global p6;
global p7;

switch cell2mat(opcion3)

case 'ATENUACION EN dB'


atenuacion = 10*log10(p3/p2)
DB = (10*log10(atenuacion)) + 30
set(handles.text10,'String',atenuacion)
set(handles.text11,'String',DB)

case 'ATENUEACION PERDIDA DE LUZ'


luz = ((10/p4)*log10(p3/p2))
DB1 = (10*log10(luz)) + 30
set(handles.text10,'String',luz)
set(handles.text11,'String',DB1)

case 'POTENCIA DE ENTRADA POR ATENUACION'


intaten = ((p3)/(10^(p7/10)))
DB2 = (10*log10(intate)) + 30
set(handles.text10,'String',intaten)
set(handles.text11,'String',DB2)

case 'POTENCIA DE SALIDA POR ATENUACION'


outaten = ((p2)*(10^(p7/10)))
DB3 = (10*log10(outaten)) + 30
set(handles.text10,'String',outaten)
set(handles.text11,'String',DB3)

case 'POTENCIA DE ENTRADA POR ATENUACION DE PERDIDA DE LUZ'


bbbb = ((p3)/(10^((p5*p4)/10)))
DB4 = (10*log10(bbbb)) + 30
set(handles.text10,'String',bbbb)
set(handles.text11,'String',DB4)

case 'POTENCIA DE SALIDA POR ATENUACION DE PERDIDA DE LUZ'


cccc = ((p2)*(10^((p5*p4)/10)))
DB5 = (10*log10(cccc)) + 30
set(handles.text10,'String',cccc)
set(handles.text11,'String',DB5)
end

function popupmenu1_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function pushbutton2_Callback(hObject, eventdata, handles)


close(PAG2)
PAG2

function edit9_Callback(hObject, eventdata, handles)


global p9;
p9 = str2double(get(hObject,'String'))
function edit9_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function radiobutton1_Callback(hObject, eventdata, handles)


global p9;
necesario = (10^((p9-30)/10))
set(handles.text15,'String',necesario)

You might also like