Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

EJERCICIO 2

% --- Executes on button press in pbejecutar.


function pbejecutar_Callback(hObject, eventdata, handles)
r=get(handles.ednum,'string');
s=str2double(r);
if s>=100 && s<=999
descomp=num2str(s);
set(handles.ednum,'string',str2double(num2str(r)));
n1=descomp(1);
set(handles.edcen,'string',str2double(num2str(n1)));

n2=descomp(2);
set(handles.eddec,'string',str2double(num2str(n2)));

n3=descomp(3);
set(handles.eduni,'string',str2double(num2str(n3)));

n=str2double(n1)+str2double(n2)+str2double(n3);set(handles.edsum,'string'
,n);
end

EJERCCIO 4
% --- 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)
A=str2double(get(handles.edA,'string'));
B=str2double(get(handles.edB,'string'));
C=str2double(get(handles.edC,'string'));
D=str2double(get(handles.edD,'string'));
E=str2double(get(handles.edE,'string'));
F=D-((D-C)*(B-E)/(B-A));
set(handles.edF,'string',num2str(F));

EJERCICIO 5

% --- Executes on button press in pbcalcular.


function pbcalcular_Callback(hObject, eventdata, handles)
% hObject handle to pbcalcular (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
moles=str2double(get(handles.edmoles,'string'));
presion=str2double(get(handles.edpresion,'string'));
volumen=str2double(get(handles.edvolumen,'string'));
R=0.082;
temperatura=(presion*volumen)/(moles*R);
set(handles.edtemperatura,'string',temperatura);

You might also like