Anda di halaman 1dari 24

UNIVERSIDAD NACIONAL JORGE BASADRE GROHMANNTACNA

FACULTAD DE INGENIERA
ESCUELA ACADMICA PROFESIONAL DE INGENIERA
QUMICA

Curso: Programacin para la Ingeniera


Tema: Proyecto de Ingeniera
Profesor: William Torres Huayta
Estudiante: Jean Carlo Pizarro Rabanal
Cdigo: 2012-36056
Grupo: B
Ao: segundo
Turno: Maana

TACNA-PERU
2013
Pgina
1

COMPOSICIN PORCENTUAL
Frmula Emprica y Molecular.
La frmula emprica es una expresin o forma que representa la proporcin ms simple
en la que estn presentes los tomos que forman un compuesto qumico, en ella se
relacionan los smbolos de los elementos con un nmero entero correspondiente a cada
smbolo. Puede coincidir o no con la frmula molecular, que indica el nmero de
tomos presentes en la molcula.
Determinacin experimental de frmulas empricas.
1. El anlisis qumico indica el numero de gramos de cada elemente presentes en una
determinada cantidad de un compuesto.
2. Las cantidades de gramos se convierten a moles de cada elemento, recuerde que para
convertir moles a gramos es necesario utilizar el peso atmico del elemento.
3. Seguidamente se debe realizar una comparacin entre las moles obtenidas a fin de
determinar la de menor valor.
4. Por ltimo las moles de los dems elementos deben ser divididas por el nmero de
moles de menor valor escogido en el numeral anterior. El cociente de esta divisin debe
ser un numero entero, en caso contrario debe aproximarse (siempre y cuando sea
posible) al valor entero ms cercano o por ensayo y error determinar un numero entero
que multiplique a todos los cocientes y los convierta en valores enteros. Una vez
realizado este procedimiento se escribe la formula emprica con lo cocientes
determinados para cada elemento.
Determinacin de Formulas Moleculares
Para calcular la frmula molecular, o real, se requiere conocer la masa molecular
aproximada del compuesto, adems de su frmula emprica. Conociendo que el peso
molecular de un compuesto debe ser un mltiplo entero (n) del peso molecular de la
frmula emprica. Por tanto,
(Peso Molecular de la Formula Emprica)*n = (Peso Molecular de la Frmula
Molecular)
El siguiente programa sirve para identificar el nmero de moles de cada elemento
en un dicho compuesto, basndose en el porcentaje de cada elemento en el
compuesto.
Pgina
2

En el siguiente programa est diseado para la composicin porcentual de 4


elementos, primeros e escoge cada elemento con el cual se va a trabajar,
seguidamente se ingresa el porcentaje para cada elemento seleccionado,
seguidamente se calcula, y se obtendr la cantidad de tomos para cada
elemento, tanto as como para el compuesto como para la molcula.
Tambin se ingresa la masa molar del compuesto aproximadamente.
En el caso de que solo se quiero trabajar con menos de 4 elementos, simplemente
no se coloca el porcentaje en el casillero que no se desea utilizar.

Codificacin Del programa:


function varargout = c_porcentual(varargin)
% C_PORCENTUAL M-file for c_porcentual.fig
%
C_PORCENTUAL, by itself, creates a new C_PORCENTUAL or raises the existing
%
singleton*.
%
%
H = C_PORCENTUAL returns the handle to a new C_PORCENTUAL or the handle to
%
the existing singleton*.
%
%
C_PORCENTUAL('CALLBACK',hObject,eventData,handles,...) calls the local
%
function named CALLBACK in C_PORCENTUAL.M with the given input arguments.
%
%
C_PORCENTUAL('Property','Value',...) creates a new C_PORCENTUAL or raises
the
%
existing singleton*. Starting from the left, property value pairs are
%
applied to the GUI before c_porcentual_OpeningFcn gets called. An
%
unrecognized property name or invalid value makes property application
%
stop. All inputs are passed to c_porcentual_OpeningFcn via varargin.
%
%
*See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
%
instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help c_porcentual
% Last Modified by GUIDE v2.5 31-Jul-2013 07:20:26
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @c_porcentual_OpeningFcn, ...
'gui_OutputFcn', @c_porcentual_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback',
[]);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout

Pgina
3

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

else

gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before c_porcentual is made visible.


function c_porcentual_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject
handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% varargin
command line arguments to c_porcentual (see VARARGIN)
% Choose default command line output for c_porcentual
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes c_porcentual wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = c_porcentual_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject
handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on selection change in E4.


function E4_Callback(hObject, eventdata, handles)
% hObject
handle to E4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns E4 contents as cell
array
%
contents{get(hObject,'Value')} returns selected item from E4

% --- Executes during object creation, after setting all properties.


function E4_CreateFcn(hObject, eventdata, handles)
% hObject
handle to E4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.

Pgina
4

%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in E3.


function E3_Callback(hObject, eventdata, handles)
% hObject
handle to E3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns E3 contents as cell
array
%
contents{get(hObject,'Value')} returns selected item from E3

% --- Executes during object creation, after setting all properties.


function E3_CreateFcn(hObject, eventdata, handles)
% hObject
handle to E3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in E2.


function E2_Callback(hObject, eventdata, handles)
% hObject
handle to E2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns E2 contents as cell
array
%
contents{get(hObject,'Value')} returns selected item from E2

% --- Executes during object creation, after setting all properties.


function E2_CreateFcn(hObject, eventdata, handles)
% hObject
handle to E2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');

Pgina
5

end

% --- Executes on selection change in E1.


function E1_Callback(hObject, eventdata, handles)
% hObject
handle to E1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns E1 contents as cell
array
%
contents{get(hObject,'Value')} returns selected item from E1

% --- Executes during object creation, after setting all properties.


function E1_CreateFcn(hObject, eventdata, handles)
% hObject
handle to E1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function N4_Callback(hObject, eventdata, handles)


% hObject
handle to N4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of N4 as text
%
str2double(get(hObject,'String')) returns contents of N4 as a double

% --- Executes during object creation, after setting all properties.


function N4_CreateFcn(hObject, eventdata, handles)
% hObject
handle to N4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function R4_Callback(hObject, eventdata, handles)

Pgina
6

% hObject
% eventdata
% handles

handle to R4 (see GCBO)


reserved - to be defined in a future version of MATLAB
structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of R4 as text


%
str2double(get(hObject,'String')) returns contents of R4 as a double

% --- Executes during object creation, after setting all properties.


function R4_CreateFcn(hObject, eventdata, handles)
% hObject
handle to R4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function N3_Callback(hObject, eventdata, handles)


% hObject
handle to N3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of N3 as text
%
str2double(get(hObject,'String')) returns contents of N3 as a double

% --- Executes during object creation, after setting all properties.


function N3_CreateFcn(hObject, eventdata, handles)
% hObject
handle to N3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function R3_Callback(hObject, eventdata, handles)


% hObject
handle to R3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of R3 as text
%
str2double(get(hObject,'String')) returns contents of R3 as a double

Pgina
7

% --- Executes during object creation, after setting all properties.


function R3_CreateFcn(hObject, eventdata, handles)
% hObject
handle to R3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function N2_Callback(hObject, eventdata, handles)


% hObject
handle to N2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of N2 as text
%
str2double(get(hObject,'String')) returns contents of N2 as a double

% --- Executes during object creation, after setting all properties.


function N2_CreateFcn(hObject, eventdata, handles)
% hObject
handle to N2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function R2_Callback(hObject, eventdata, handles)


% hObject
handle to R2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of R2 as text
%
str2double(get(hObject,'String')) returns contents of R2 as a double

% --- Executes during object creation, after setting all properties.


function R2_CreateFcn(hObject, eventdata, handles)
% hObject
handle to R2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB

Pgina
8

% handles

empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function N_Callback(hObject, eventdata, handles)


% hObject
handle to N (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of N as text
%
str2double(get(hObject,'String')) returns contents of N as a double

% --- Executes during object creation, after setting all properties.


function N_CreateFcn(hObject, eventdata, handles)
% hObject
handle to N (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function R1_Callback(hObject, eventdata, handles)


% hObject
handle to R1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of R1 as text
%
str2double(get(hObject,'String')) returns contents of R1 as a double

% --- Executes during object creation, after setting all properties.


function R1_CreateFcn(hObject, eventdata, handles)
% hObject
handle to R1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))

Pgina
9

end

set(hObject,'BackgroundColor','white');

% --- 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)
C1=get(handles.E1,'value');
switch C1
case 1
M=1.00797;
case 2
M=4.0026;
case 3
M=6.941;
case 4
M=9.012;
case 5
M=10.81;
case 6
M=12.011;
case 7
M=14.067;
case 8
M=15.999;
case 9
M=18.998;
case 10
M=20.179;
case 11
M=22.989;
case 12
M=24.305;
case 13
M=26.98;
case 14
M=28.08;
case 15
M=30.97;
case 16
M=32.06;
case 17
M=35.45;
case 18
M=39.94;
case 19
M=39.10;
case 20
M=40.08;
case 21
M=44.95;
case 22
M=47.88;
case 23

Pgina
10

M=50.94;
case 24
M=51.99;
case 25
M=54.93;
case 26
M=55.84;
case 27
M=58.93;
case 28
M=58.69;
case 29
M=63.54;
case 30
M=65.38;
case 31
M=68.72;
case 32
M=75.59;
case 33
M=74.92;
case 34
M=78.96;
case 35
M=79.90;
case 36
M=83.80;
case 37
M=85.46;
case 38
M=87.62;
case 39
M=85.90;
case 40
M=91.92;
case 41
M=92.90;
case 42
M=95.94;
case 43
M=98.44;
case 44
M=101.07;
case 45
M=102.90;
case 46
M=106.42;
case 47
M=107.86;
case 48
M=112.41;
case 49
M=114.82;
case 50
M=118.59;
case 51

Pgina
11

M=127.75;
case 52
M=127.60;
case 53
M=126.90;
case 54
M=131.29;
case 55
M=132.90;
case 56
M=137.33;
case 57
M=138.90;
case 58
M=171.49;
case 59
M=180.94;
case 60
M=183.85;
case 61
M=186.20;
case 62
M=190.2;
case 63
M=192.2;
case 64
M=195.08;
case 65
M=196.96;
case 66
M=200.59;
case 67
M=204.38;
case 68
M=207.2;
case 69
M=208.98;
case 70
M=209;
case 71
M=210;
otherwise
M=222;

end
C2=get(handles.E2,'value');
switch C2
case 1
M2=1.00797;
case 2
M2=4.0026;
case 3
M2=6.941;
case 4
M2=9.012;
case 5
M2=10.81;

Pgina
12

case 6
M2=12.011;
case 7
M2=14.067;
case 8
M2=15.999;
case 9
M2=18.998;
case 10
M2=20.179;
case 11
M2=22.989;
case 12
M2=24.305;
case 13
M2=26.98;
case 14
M2=28.08;
case 15
M2=30.97;
case 16
M2=32.06;
case 17
M2=35.45;
case 18
M2=39.94;
case 19
M2=39.10;
case 20
M2=40.08;
case 21
M2=44.95;
case 22
M2=47.88;
case 23
M2=50.94;
case 24
M2=51.99;
case 25
M2=54.93;
case 26
M2=55.84;
case 27
M2=58.93;
case 28
M2=58.69;
case 29
M2=63.54;
case 30
M2=65.38;
case 31
M2=68.72;
case 32
M2=75.59;
case 33
M2=74.92;

Pgina
13

case 34
M2=78.96;
case 35
M2=79.90;
case 36
M2=83.80;
case 37
M2=85.46;
case 38
M2=87.62;
case 39
M2=85.90;
case 40
M2=91.92;
case 41
M2=92.90;
case 42
M2=95.94;
case 43
M2=98.44;
case 44
M2=101.07;
case 45
M2=102.90;
case 46
M2=106.42;
case 47
M2=107.86;
case 48
M2=112.41;
case 49
M2=114.82;
case 50
M2=118.59;
case 51
M2=127.75;
case 52
M2=127.60;
case 53
M2=126.90;
case 54
M2=131.29;
case 55
M2=132.90;
case 56
M2=137.33;
case 57
M2=138.90;
case 58
M2=171.49;
case 59
M2=180.94;
case 60
M2=183.85;
case 61
M2=186.20;

Pgina
14

case 62
M2=190.2;
case 63
M2=192.2;
case 64
M2=195.08;
case 65
M2=196.96;
case 66
M2=200.59;
case 67
M2=204.38;
case 68
M2=207.2;
case 69
M2=208.98;
case 70
M2=209;
case 71
M2=210;
otherwise
M2=222;
end
C3=get(handles.E3,'value');
switch C3
case 1
M3=1.00797;
case 2
M3=4.0026;
case 3
M3=6.941;
case 4
M3=9.012;
case 5
M3=10.81;
case 6
M3=12.011;
case 7
M3=14.067;
case 8
M3=15.999;
case 9
M3=18.998;
case 10
M3=20.179;
case 11
M3=22.989;
case 12
M3=24.305;
case 13
M3=26.98;
case 14
M3=28.08;
case 15
M3=30.97;
case 16

Pgina
15

M3=32.06;
case 17
M3=35.45;
case 18
M3=39.94;
case 19
M3=39.10;
case 20
M3=40.08;
case 21
M3=44.95;
case 22
M3=47.88;
case 23
M3=50.94;
case 24
M3=51.99;
case 25
M3=54.93;
case 26
M3=55.84;
case 27
M3=58.93;
case 28
M3=58.69;
case 29
M3=63.54;
case 30
M3=65.38;
case 31
M3=68.72;
case 32
M3=75.59;
case 33
M3=74.92;
case 34
M3=78.96;
case 35
M3=79.90;
case 36
M3=83.80;
case 37
M3=85.46;
case 38
M3=87.62;
case 39
M3=85.90;
case 40
M3=91.92;
case 41
M3=92.90;
case 42
M3=95.94;
case 43
M3=98.44;
case 44

Pgina
16

M3=101.07;
case 45
M3=102.90;
case 46
M3=106.42;
case 47
M3=107.86;
case 48
M3=112.41;
case 49
M3=114.82;
case 50
M3=118.59;
case 51
M3=127.75;
case 52
M3=127.60;
case 53
M3=126.90;
case 54
M3=131.29;
case 55
M3=132.90;
case 56
M3=137.33;
case 57
M3=138.90;
case 58
M3=171.49;
case 59
M3=180.94;
case 60
M3=183.85;
case 61
M3=186.20;
case 62
M3=190.2;
case 63
M3=192.2;
case 64
M3=195.08;
case 65
M3=196.96;
case 66
M3=200.59;
case 67
M3=204.38;
case 68
M3=207.2;
case 69
M3=208.98;
case 70
M3=209;
case 71
M3=210;
otherwise

Pgina
17

M3=222;
end
C4=get(handles.E4,'value');
switch C4
case 1
M4=1.00797;
case 2
M4=4.0026;
case 3
M4=6.941;
case 4
M4=9.012;
case 5
M4=10.81;
case 6
M4=12.011;
case 7
M4=14.067;
case 8
M4=15.999;
case 9
M4=18.998;
case 10
M4=20.179;
case 11
M4=22.989;
case 12
M4=24.305;
case 13
M4=26.98;
case 14
M4=28.08;
case 15
M4=30.97;
case 16
M4=32.06;
case 17
M4=35.45;
case 18
M4=39.94;
case 19
M4=39.10;
case 20
M4=40.08;
case 21
M4=44.95;
case 22
M4=47.88;
case 23
M4=50.94;
case 24
M4=51.99;
case 25
M4=54.93;
case 26
M4=55.84;

Pgina
18

case 27
M4=58.93;
case 28
M4=58.69;
case 29
M4=63.54;
case 30
M4=65.38;
case 31
M4=68.72;
case 32
M4=75.59;
case 33
M4=74.92;
case 34
M4=78.96;
case 35
M4=79.90;
case 36
M4=83.80;
case 37
M4=85.46;
case 38
M4=87.62;
case 39
M4=85.90;
case 40
M4=91.92;
case 41
M4=92.90;
case 42
M4=95.94;
case 43
M4=98.44;
case 44
M4=101.07;
case 45
M4=102.90;
case 46
M4=106.42;
case 47
M4=107.86;
case 48
M4=112.41;
case 49
M4=114.82;
case 50
M4=118.59;
case 51
M4=127.75;
case 52
M4=127.60;
case 53
M4=126.90;
case 54
M4=131.29;

Pgina
19

case 55
M4=132.90;
case 56
M4=137.33;
case 57
M4=138.90;
case 58
M4=171.49;
case 59
M4=180.94;
case 60
M4=183.85;
case 61
M4=186.20;
case 62
M4=190.2;
case 63
M4=192.2;
case 64
M4=195.08;
case 65
M4=196.96;
case 66
M4=200.59;
case 67
M4=204.38;
case 68
M4=207.2;
case 69
M4=208.98;
case 70
M4=209;
case 71
M4=210;
otherwise
M4=222;
end
p1=str2double(get(handles.R1,'string'));
p2=str2double(get(handles.R2,'string'));
p3=str2double(get(handles.R3,'string'));
p4=str2double(get(handles.R4,'string'));
R=p1/M;
R2=p2/M2;
R3=p3/M3;
R4=p4/M4;
Rm1=min(R,R2);
Rm2=min(R3,R4);
Rm=min(Rm1,Rm2);
r=R/Rm;
r2=R2/Rm;
r3=R3/Rm;
r4=R4/Rm;
r=round(r);
r2=round(r2);
r3=round(r3);
r4=round(r4);

Pgina
20

PM=str2double(get(handles.m,'string'));
fe=M*r+M2*r2+M3*r3+M4*r4;
x=PM/fe;
x=round(x);
c1=x*r;
c2=x*r2;
c3=x*r3;
c4=x*r4;
set(handles.m1,'string',c1);
set(handles.m2,'string',c2);
set(handles.m3,'string',c3);
set(handles.m4,'string',c4);
set(handles.N,'string',r);
set(handles.N2,'string',r2);
set(handles.N3,'string',r3);
set(handles.N4,'string',r4);

function m2_Callback(hObject, eventdata, handles)


% hObject
handle to m2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of m2 as text
%
str2double(get(hObject,'String')) returns contents of m2 as a double

% --- Executes during object creation, after setting all properties.


function m2_CreateFcn(hObject, eventdata, handles)
% hObject
handle to m2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function m4_Callback(hObject, eventdata, handles)


% hObject
handle to m4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of m4 as text
%
str2double(get(hObject,'String')) returns contents of m4 as a double

% --- Executes during object creation, after setting all properties.


function m4_CreateFcn(hObject, eventdata, handles)

Pgina
21

% hObject
% eventdata
% handles

handle to m4 (see GCBO)


reserved - to be defined in a future version of MATLAB
empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function m3_Callback(hObject, eventdata, handles)


% hObject
handle to m3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of m3 as text
%
str2double(get(hObject,'String')) returns contents of m3 as a double

% --- Executes during object creation, after setting all properties.


function m3_CreateFcn(hObject, eventdata, handles)
% hObject
handle to m3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function m1_Callback(hObject, eventdata, handles)


% hObject
handle to m1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of m1 as text
%
str2double(get(hObject,'String')) returns contents of m1 as a double

% --- Executes during object creation, after setting all properties.


function m1_CreateFcn(hObject, eventdata, handles)
% hObject
handle to m1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.

Pgina
22

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


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

function m_Callback(hObject, eventdata, handles)


% hObject
handle to m (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of m as text
%
str2double(get(hObject,'String')) returns contents of m as a double

% --- Executes during object creation, after setting all properties.


function m_CreateFcn(hObject, eventdata, handles)
% hObject
handle to m (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

Ejemplo:
El indigo,
colorante azul
los pantalones
Jeans, tiene la
composicin
porcentual:
C:
H:
N:
O:

de

73.27 %
3.84 %
10.68 %
12.21 %

Masa Molar
aproximada del
compuesto:
262.3 g/mol
Solucin:
Pgina
23

Se ingresa los valores porcentuales escogiendo el elemento, y la masa


molar aproximada
Se obtendr el nmero de tomos del compuesto como el nmero de
tomos de la molcula.

Pgina
24

Anda mungkin juga menyukai