Trabajo Monográfico PDF
Trabajo Monográfico PDF
HUAMANGA
DEPARTAMENTO ACADÉMICO DE INGENIERÍA CIVIL,
GEOLOGÍA Y MINAS
ESCUELA PROFESIONAL DE INGENIERÍA CIVIL
PROGRAMA DE CONVERSIÓN DE
UNIDADES EN MATLAB
DOCENTE:
ABNER CURI VEGA
ESTUDIANTES:
PALOMINO BAUTISTA JORGE LUIS
JAYO YUTO MIGUEL ANGEL
AYACUCHO-PERÚ
2020
DEDICATORIA
1
Índice general
Contents 2
0.1. CÓDIGO DEL PROGRAMA . . . . . . . . . . . . . . . . . . . . . . . . . . 3
0.2. CÓDIGO DEL PROGRAMA GENERAL (UNTITLED) . . . . . . . . . . . . 3
CÓDIGO DE LA VENTANA PRINCIPAL (IMÁGENES O AXES) . . . . . . 3
CÓDIGO DE LOS BOTONES DE INFORMACIÓN Y AYUDA . . . . . . . . 3
CÓDIGO DEL BOTÓN DE SALIR . . . . . . . . . . . . . . . . . . . . . . . 4
CÓDIGO DE LOS BOTONES DE LAS UNIDADES . . . . . . . . . . . . . 4
0.3. CODIGOS DE LAS DEMÁS GUIDES . . . . . . . . . . . . . . . . . . . . . 5
CÓDIGO DE CAUDAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
CÓDIGO DE ÁREA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
CÓDIGO DE VOLUMEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
CÓDIGO DE FUERZA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
CÓDIGO DE PRESIÓN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
CÓDIGO DE GRADOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
CÓDIGO DE TEMPERATURA . . . . . . . . . . . . . . . . . . . . . . . . . 17
CODIGO DE VELOCIDAD . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2
0.1. CÓDIGO DEL PROGRAMA
El siguiente programa trata principalmente de la unión y conexión de varios Guides con ayuda
de los botones y del comando CLOSE, a continuación presentaremos cada código que se usó
para los botones del Guide, y como se logró unir varios Guides.
msgbox(’Programa creado por: Palomino Bautista Jorge Luis y Miguel Jayo Yuto Mguel An-
gel’);
% — Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
3
% handles structure with handles and user data (see GUIDATA)
msgbox(’Para usar el programa solo escoja la unidad en la que quiera trabajar’);
close(untitled);
close(untitled);
VOLUMEN
% — Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
close(untitled);
PRESION
% — Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
close(untitled);
CAUDAL
% — Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
close(untitled)
AREA
% — Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
velocidad
% — Executes on button press in pushbutton16.
close(untitled);
ejemplo1
% — Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton17 (see GCBO)
4
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(untitled);
LONGITUD
% — Executes on button press in pushbutton18.
function pushbutton18_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton18 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(untitled)
ejemplo2
% — Executes on button press in pushbutton19.
function pushbutton19_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton19 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(untitled)
FUERZA
% — Executes on button press in pushbutton20.
function pushbutton20_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton20 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(untitled);
volumen
5
CÓDIGO DE CAUDAL
6
else
x=dm3+x;
end
if x∼ =0
m3=10ˆ (-3)∗ dm3;
km3=10ˆ (-14)∗ dm3;
ft3=0.04∗ dm3;
in3=61.02∗ dm3;
set(handles.edit1,’string’,m3);
set(handles.edit2,’string’,km3);
set(handles.edit4,’string’,ft3);
set(handles.edit5,’string’,in3);
break
else
x=x+ft3;
end
if x∼ =0
m3=0.03∗ ft3;
km3=2.83∗ 10ˆ (11)∗ ft3;
dm3=28.32∗ ft3;
in3=1728∗ ft3;
set(handles.edit1,’string’,m3);
set(handles.edit2,’string’,km3);
set(handles.edit3,’string’,dm3);
set(handles.edit5,’string’,in3);
break
else
x=x+in3;
end
if x∼ =0
m3=1.64∗ 10ˆ (-5)∗ in3;
km3=1.64∗ 10ˆ (-14)∗ in3;
dm3=0.02∗ in3;
ft3=5.79∗ 10ˆ (-4)∗ in3;
set(handles.edit1,’string’,m3);
set(handles.edit2,’string’,km3);
set(handles.edit3,’string’,dm3);
set(handles.edit4,’string’,ft3);
end
end
7
CÓDIGO DE ÁREA
if x∼ =0
cm2= 10000∗ m2;
in2=1550∗ m2;
dm2=100∗ m2;
ft2=10.76∗ m2;
set(handles.edit2,’string’,cm2)
set(handles.edit3,’string’,in2)
set(handles.edit4,’string’,dm2)
set(handles.edit5,’string’,ft2)
break
else
x=cm2+x;
end
if x∼ =0
m2= 10ˆ (-4)∗ cm2;
in2=0.16∗ cm2;
dm2=0.01∗ cm2;
ft2=1.08∗ 10ˆ (-3)∗ cm2;
set(handles.edit1,’string’,m2)
set(handles.edit3,’string’,in2)
set(handles.edit4,’string’,dm2)
8
set(handles.edit5,’string’,ft2)
break
else
x=in2+x;
end
if x∼ =0
cm2= 6.45∗ in2;
m2=6.45∗ 10ˆ (-4)∗ in2;
dm2=0.06∗ in2;
ft2=0.11∗ in2;
set(handles.edit2,’string’,cm2)
set(handles.edit1,’string’,m2)
set(handles.edit4,’string’,dm2)
set(handles.edit5,’string’,ft2)
break
else
x=dm2+x;
end
if x∼ =0
cm2= 100∗ dm2;
in2=15.5∗ dm2;
m2=0.0100∗ dm2;
ft2=0.11∗ dm2;
set(handles.edit2,’string’,cm2)
set(handles.edit3,’string’,in2)
set(handles.edit1,’string’,m2)
set(handles.edit5,’string’,ft2)
break
else
x=ft2+x;
end
if x∼ =0
cm2= 929.03∗ ft2;
in2=144∗ ft2;
m2=0.09∗ ft2;
9
dm2=9.29∗ ft2;
set(handles.edit2,’string’,cm2)
set(handles.edit3,’string’,in2)
set(handles.edit1,’string’,m2)
set(handles.edit4,’string’,dm2)
end
end
CÓDIGO DE VOLUMEN
% — Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
m3=eval(get(handles.edit1,’string’));
cm3=eval(get(handles.edit2,’string’));
in3=eval(get(handles.edit3,’string’));
dm3=eval(get(handles.edit4,’string’));
ft3=eval(get(handles.edit5,’string’));
for i=1:1
x=0;
x=m3+x;
if x∼ =0
cm3=1000000∗ m3;
in3=61023.76∗ m3;
dm3=1000∗ m3;
ft3=35.315∗ m3;
set(handles.edit2,’string’,cm3)
set(handles.edit3,’string’,in3)
set(handles.edit4,’string’,dm3)
set(handles.edit5,’string’,ft3)
break
else
10
x=cm3+x;
end
if x∼ =0
m3=(1/1000000)∗ cm3;
in3=0.061∗ cm3;
dm3=0.001∗ cm3;
ft3=3.531∗ 10ˆ (-5)∗ cm3;
set(handles.edit1,’string’,m3)
set(handles.edit3,’string’,in3)
set(handles.edit4,’string’,dm3)
set(handles.edit5,’string’,ft3)
break
else
x=in3+x;
end
if x∼ =0
m3=1.6387∗ 10ˆ (-5)∗ in3;
cm3=16.387∗ in3;
dm3=0.0164∗ in3;
ft3=0.000579∗ in3;
set(handles.edit1,’string’,m3)
set(handles.edit2,’string’,cm3)
set(handles.edit4,’string’,dm3)
set(handles.edit5,’string’,ft3)
break
else
x=dm3+x;
end
if x∼ =0
m3=0.001∗ dm3;
cm3=1000∗ dm3;
in3=61.02376∗ dm3;
ft3=0.035315∗ dm3;
11
set(handles.edit1,’string’,m3)
set(handles.edit2,’string’,cm3)
set(handles.edit3,’string’,in3)
set(handles.edit5,’string’,ft3)
break
else
x=ft3+x;
end
if x∼ =0
m3=0.028317∗ ft3;
cm3=28316.8359∗ ft3;
in3=1727.999∗ ft3;
dm3=28.3168∗ ft3;
set(handles.edit1,’string’,m3)
set(handles.edit2,’string’,cm3)
set(handles.edit3,’string’,in3)
set(handles.edit4,’string’,dm3)
end
end
CÓDIGO DE FUERZA
set(handles.txtKILOGRAMO,’String’,kilogramo);
set(handles.txtLIBRA,’String’,libra)
12
% — Executes on button press in btnCALCULAR2.
function btnCALCULAR2_Callback(hObject, eventdata, handles)
kilogramo=eval(get(handles.txtKILOGRAMO,’String’));
newton=(kilogramo∗ 4.4482)/0.453592;
libra=kilogramo/0.453592;
set(handles.txtNEWTON,’String’,newton);
set(handles.txtLIBRA,’String’,libra)
set(handles.txtKILOGRAMO,’String’,kilogramo);
set(handles.txtNEWTON,’String’,newton)
CÓDIGO DE PRESIÓN
pa=eval(get(handles.edit1,’string’));
Ba=eval(get(handles.edit2,’string’));
ki=eval(get(handles.edit4,’string’));
atm=eval(get(handles.edit3,’string’));
mmhg=eval(get(handles.edit5,’string’));
psi=eval(get(handles.edit6,’string’));
x=0;
13
x=pa+x;
for i=1:1
if x∼ =0
Ba=(0.1∗ pa);
ki=0.101972∗ pa;
atm=101325∗ pa;
mmhg=133.322∗ pa;
psi=6894.76∗ pa;
set(handles.edit2,’string’,Ba)
set(handles.edit4,’string’,ki)
set(handles.edit3,’string’,atm)
set(handles.edit5,’string’,mmhg)
set(handles.edit6,’string’,psi)
break
elseif x==0
x=x+Ba;
end
% para Ba
if x∼ =0
pa=(10∗ Ba);
ki=0.0101972∗ Ba;
atm=9.8692∗ 10ˆ (-7)∗ Ba;
mmhg=0.000750062∗ Ba;
psi=1.45038∗ 10ˆ (-5)∗ Ba;
set(handles.edit1,’string’,pa)
set(handles.edit4,’string’,ki)
set(handles.edit3,’string’,atm)
set(handles.edit5,’string’,mmhg)
set(handles.edit6,’string’,psi)
break
elseif x==0
x=x+ki;
end
% para ki
if x∼ =0
pa=(9.80665∗ ki);
14
Ba=98.0665∗ ki;
atm=9.6784e-5∗ ki;
mmhg=0.0735559∗ ki;
psi=0.00142233∗ ki;
set(handles.edit1,’string’,pa)
set(handles.edit2,’string’,Ba)
set(handles.edit3,’string’,atm)
set(handles.edit5,’string’,mmhg)
set(handles.edit6,’string’,psi)
break
else
x=x+atm;
% para atm
end
if x∼ =0
pa=(101325∗ atm);
ki=10332.3∗ atm;
Ba=1.013e+6∗ atm;
mmhg=760∗ atm;
psi=14.6959∗ atm;
set(handles.edit1,’string’,pa)
set(handles.edit2,’string’,Ba)
set(handles.edit4,’string’,ki)
set(handles.edit5,’string’,mmhg)
set(handles.edit6,’string’,psi)
break
else
x=x+mmhg;
end
% para mmhg
if x∼ =0
pa=(10∗ mmhg);
ki=133.322∗ mmhg;
atm=13.5951∗ mmhg;
Ba=1333.22∗ mmhg;
psi=0.0193368∗ mmhg;
set(handles.edit1,’string’,pa)
set(handles.edit4,’string’,ki)
15
set(handles.edit3,’string’,atm)
set(handles.edit2,’string’,Ba)
set(handles.edit6,’string’,psi)
break
else
x=x+psi;
end
if x∼ =0
pa=(6894.76∗ psi);
ki=0.070307∗ psi;
atm=0.068046∗ psi;
Ba=68947.6∗ psi;
mmhg=51.7149∗ psi;
set(handles.edit1,’string’,pa)
set(handles.edit4,’string’,ki)
set(handles.edit3,’string’,atm)
set(handles.edit2,’string’,Ba)
set(handles.edit5,’string’,mmhg)
end
end
CÓDIGO DE GRADOS
% — Executes on button press in btnCalcular1.
function btnCalcular1_Callback(hObject, eventdata, handles)
misexagesimales=eval(get(handles.txtSexagesimales,’String’));
micentecimales=(misexagesimales∗ 10)/9;
miradianes=(3.1516∗ misexagesimales)/180;
set(handles.txtCentecimales,’String’,micentecimales);
set(handles.txtRadianes,’String’,miradianes);
16
miradianes=(3.1416∗ micentecimales)/200;
set(handles.txtSexagesimales,’String’,misexagesimales);
set(handles.txtRadianes,’String’,miradianes);
set(handles.txtSexagesimales,’String’,misexagesimales);
set(handles.txtCentecimales,’String’,micentecimales);
CÓDIGO DE TEMPERATURA
set(handles.txtKelvin,’String’,mikelvin);
set(handles.txtFahrenheit,’String’,mifahrenheit);
set(handles.txtFahrenheit,’String’,mifahrenheit);
set(handles.txtCelcius,’String’,micelcius)
17
% — Executes on button press in btnCalcular3.
function btnCalcular3_Callback(hObject, eventdata, handles)
mifahrenheit=eval(get(handles.txtFahrenheit,’String’));
micelcius=(mifahrenheit-32)∗ 5/9;
mikelvin=((mifahrenheit-32)∗ 5/9)+273.15;
set(handles.txtCelcius,’String’,micelcius);
set(handles.txtKelvin,’String’,mikelvin);
CODIGO DE VELOCIDAD
ms=eval(get(handles.edit1,’string’));
kmh=eval(get(handles.edit2,’string’));
mms=eval(get(handles.edit3,’string’));
mis=eval(get(handles.edit4,’string’));
fts=eval(get(handles.edit5,’string’));
kms=eval(get(handles.edit6,’string’));
for i=1:1
x=0;
x=ms+x;
if x∼ =0
kmh=3.6∗ ms;
mms=1000∗ ms;
18
mis=0.001∗ ms;
fts=3.281∗ ms;
kms=0.001∗ ms;
set(handles.edit2,’string’,kmh)
set(handles.edit3,’string’,mms)
set(handles.edit4,’string’,mis)
set(handles.edit5,’string’,fts)
set(handles.edit6,’string’,kms)
break
else
x=x+kmh;
end
if x∼ =0
ms=0.278∗ kmh;
mms=277.778∗ kmh;
fts=0.911∗ kmh;
kms=277.788∗ kmh;
set(handles.edit1,’string’,ms)
set(handles.edit3,’string’,mms)
set(handles.edit4,’string’,mis)
set(handles.edit5,’string’,fts)
set(handles.edit6,’string’,kms)
break
else
x=x+mms;
19
end
if x∼ =0
kmh=0.004∗ mms;
ms=0.001∗ mms;
fts=0.0033∗ mms;
set(handles.edit2,’string’,kmh)
set(handles.edit1,’string’,ms)
set(handles.edit4,’string’,mis)
set(handles.edit5,’string’,fts)
set(handles.edit6,’string’,kms)
break
else
x=x+mis;
end
if x∼ =0
kmh=5793.638∗ mis;
ms=1609.344∗ mis;
mms=1609344∗ mis;
fts=5280∗ mis;
kms=1.609∗ mis;
set(handles.edit2,’string’,kmh)
set(handles.edit1,’string’,ms)
set(handles.edit3,’string’,mms)
20
set(handles.edit5,’string’,fts)
set(handles.edit6,’string’,kms)
break
else
x=x+fts;
end
if x∼ =0
kmh=1097∗ fts;
ms=0.305∗ fts;
mms=304.8∗ fts;
set(handles.edit2,’string’,kmh)
set(handles.edit1,’string’,ms)
set(handles.edit3,’string’,mms)
set(handles.edit4,’string’,mis)
set(handles.edit6,’string’,kms)
break
else
x=x+kms;
end
if x∼ =0
kmh=3600∗ kms;
ms=1000∗ kms;
mms=1000000∗ kms;
21
mis=0.621∗ kms;
fts=3280.84∗ kms;
set(handles.edit2,’string’,kmh)
set(handles.edit1,’string’,ms)
set(handles.edit3,’string’,mms)
set(handles.edit4,’string’,mis)
set(handles.edit5,’string’,fts)
end
end
22
ANEXOS
Figura 1: presentación del programa
23
Figura 3: Ventana de la unidad de longitud (forma 2)
24