Anda di halaman 1dari 34

ESCUELA POLITECNICA NACIONAL

FACULTAD DE INGENIERIA ELECTRICA Y ELECTRONICA

Software de Simulacin

NOMBRE : Gabriela Camino Ipiales


PROFESOR : MSc. Marco Yacelga
PARALELO : GR 3

DEBER

Realizar una calculadora cientfica con su respectiva cartula.

Imagen utilizada en la cartula:

Relampago.jpg

CDIGO de la cartula:
function varargout = Caratula(varargin)
% CARATULA MATLAB code for Caratula.fig
% CARATULA, by itself, creates a new CARATULA or raises the existing
% singleton*.
%
% H = CARATULA returns the handle to a new CARATULA or the handle to
% the existing singleton*.
%
% CARATULA('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CARATULA.M with the given input arguments.
%
% CARATULA('Property','Value',...) creates a new CARATULA or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Caratula_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Caratula_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 Caratula

% Last Modified by GUIDE v2.5 02-Jul-2016 22:00:46

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Caratula_OpeningFcn, ...
'gui_OutputFcn', @Caratula_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
% End initialization code - DO NOT EDIT

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


function Caratula_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 Caratula (see VARARGIN)

% Choose default command line output for Caratula


handles.output = hObject;

[X,map] = imread('Relampago.jpg','jpg');
image(X),colormap(map),axis off, hold on

text(30,9,'ESCUELA POLITCNICA','Fontname','Broadway','FontSize',25,...
'Fontangle','Italic','Fontweight','Bold','color',[1 1 1]);
text(85,23,'NACIONAL','Fontname','Broadway','FontSize',25,...
'Fontangle','Italic','Fontweight','Bold','color',[1 1 1]);

text(3,38,'Facultad de Ingeniera Elctrica y


Electrnica','Fontname','ALGERIAN','FontSize',15,...
'Fontangle','Italic','Fontweight','Bold','color',[0 0 1]);
text(57,50,'Software de Simulacin','Fontname','Old English Text
MT','FontSize',23,...
'Fontangle','Italic','Fontweight','Bold','color',[1 0 1]);

boton= uicontrol('Style', 'pushbutton', 'String', 'CONTINUAR',...


'Position', [450 20 100 20],...
'Callback', 'clear all;close all;clc;Calculadora');

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes Caratula wait for user response (see UIRESUME)


% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Caratula_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;

CAPTURA DE PANTALLA de la caratula:


Cdigo de la calculadora:
function varargout = Calculadora(varargin)
% CALCULADORA MATLAB code for Calculadora.fig
% CALCULADORA, by itself, creates a new CALCULADORA or raises the
existing
% singleton*.
%
% H = CALCULADORA returns the handle to a new CALCULADORA or the handle
to
% the existing singleton*.
%
% CALCULADORA('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CALCULADORA.M with the given input
arguments.
%
% CALCULADORA('Property','Value',...) creates a new CALCULADORA or
raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Calculadora_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Calculadora_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 Calculadora

% Last Modified by GUIDE v2.5 04-Jul-2016 00:48:06

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Calculadora_OpeningFcn, ...
'gui_OutputFcn', @Calculadora_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
% End initialization code - DO NOT EDIT

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


function Calculadora_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 Calculadora (see VARARGIN)

% Choose default command line output for Calculadora


handles.output = hObject;

boton= uicontrol('Style', 'pushbutton', 'String', 'REGRESAR',...


'Position', [333 20 100 20],...
'Callback', 'clear all;close all;clc;Caratula');

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes Calculadora wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = Calculadora_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;

function pantalla_Callback(hObject, eventdata, handles)


% hObject handle to pantalla (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 pantalla as text


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

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


function pantalla_CreateFcn(hObject, eventdata, handles)
% hObject handle to pantalla (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

% --- Executes on button press in uno.


function uno_Callback(hObject, eventdata, handles)
% hObject handle to uno (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'1');
set(handles.pantalla,'String',textstring)
% --- Executes on button press in cero.
function cero_Callback(hObject, eventdata, handles)
% hObject handle to cero (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'0');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in dos.


function dos_Callback(hObject, eventdata, handles)
% hObject handle to dos (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'2');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in tres.


function tres_Callback(hObject, eventdata, handles)
% hObject handle to tres (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'3');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in cuatro.


function cuatro_Callback(hObject, eventdata, handles)
% hObject handle to cuatro (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'4');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in cinco.


function cinco_Callback(hObject, eventdata, handles)
% hObject handle to cinco (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'5');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in seis.


function seis_Callback(hObject, eventdata, handles)
% hObject handle to seis (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'6');
set(handles.pantalla,'String',textstring)
% --- Executes on button press in siete.
function siete_Callback(hObject, eventdata, handles)
% hObject handle to siete (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'7');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in ocho.


function ocho_Callback(hObject, eventdata, handles)
% hObject handle to ocho (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'8');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in nueve.


function nueve_Callback(hObject, eventdata, handles)
% hObject handle to nueve (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'9');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in salir.


function salir_Callback(hObject, eventdata, handles)
% hObject handle to salir (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
boton2=questdlg('DESEA SALIR DEL PROGRAMA
CALCULADORA?','Salir','Si','No','Si');
if boton2=='Si'
clear all,close all,clc
end

% --- Executes on button press in punto.


function punto_Callback(hObject, eventdata, handles)
% hObject handle to punto (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'.');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in mas.


function mas_Callback(hObject, eventdata, handles)
% hObject handle to mas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'+');
set(handles.pantalla,'String',textstring)
% --- Executes on button press in menos.
function menos_Callback(hObject, eventdata, handles)
% hObject handle to menos (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'-');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in por.


function por_Callback(hObject, eventdata, handles)
% hObject handle to por (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'*');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in div.


function div_Callback(hObject, eventdata, handles)
% hObject handle to div (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'/');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in igual.


function igual_Callback(hObject, eventdata, handles)
% hObject handle to igual (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=eval(textstring);
set(handles.pantalla,'String',textstring)

% --- Executes on button press in limpiar.


function limpiar_Callback(hObject, eventdata, handles)
% hObject handle to limpiar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
c=char(' ');
set(handles.pantalla,'String',c)

% --- Executes on button press in parentesis1.


function parentesis1_Callback(hObject, eventdata, handles)
% hObject handle to parentesis1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'(');
set(handles.pantalla,'String',textstring)
% --- Executes on button press in parentesis2.
function parentesis2_Callback(hObject, eventdata, handles)
% hObject handle to parentesis2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,')');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in elevado.


function elevado_Callback(hObject, eventdata, handles)
% hObject handle to elevado (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'^');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in cuadrado.


function cuadrado_Callback(hObject, eventdata, handles)
% hObject handle to cuadrado (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'^2');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in cubo.


function cubo_Callback(hObject, eventdata, handles)
% hObject handle to cubo (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'^3');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in pi.


function pi_Callback(hObject, eventdata, handles)
% hObject handle to pi (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'pi');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in exponencial.


function exponencial_Callback(hObject, eventdata, handles)
% hObject handle to exponencial (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'2.718281');
set(handles.pantalla,'String',textstring)
% --- Executes on button press in seno.
function seno_Callback(hObject, eventdata, handles)
% hObject handle to seno (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'sind(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in coseno.


function coseno_Callback(hObject, eventdata, handles)
% hObject handle to coseno (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'cosd(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in tangente.


function tangente_Callback(hObject, eventdata, handles)
% hObject handle to tangente (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'tand(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in log.


function log_Callback(hObject, eventdata, handles)
% hObject handle to log (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'log10(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in ln.


function ln_Callback(hObject, eventdata, handles)
% hObject handle to ln (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'log(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in raiz.


function raiz_Callback(hObject, eventdata, handles)
% hObject handle to raiz (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'nthroot(');
set(handles.pantalla,'String',textstring)
% --- Executes on button press in rcuadrada.
function rcuadrada_Callback(hObject, eventdata, handles)
% hObject handle to rcuadrada (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'sqrt(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in rcubica.


function rcubica_Callback(hObject, eventdata, handles)
% hObject handle to rcubica (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'nthroot( ',textstring,',3)');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in coma.


function coma_Callback(hObject, eventdata, handles)
% hObject handle to coma (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,',');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in X.


function X_Callback(hObject, eventdata, handles)
% hObject handle to X (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'X');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in Y.


function Y_Callback(hObject, eventdata, handles)
% hObject handle to Y (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'Y');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in graficar.


function graficar_Callback(hObject, eventdata, handles)
% hObject handle to graficar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes2);
valor=get(handles.pantalla,'String');
hold on
ezplot(valor)
grid
axis on
hold off

% --- Executes on button press in senoradianes.


function senoradianes_Callback(hObject, eventdata, handles)
% hObject handle to senoradianes (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'sin(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in cosenoradianes.


function cosenoradianes_Callback(hObject, eventdata, handles)
% hObject handle to cosenoradianes (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'cos(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in tangenteradianes.


function tangenteradianes_Callback(hObject, eventdata, handles)
% hObject handle to tangenteradianes (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'tan(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in limpiargrafica.


function limpiargrafica_Callback(hObject, eventdata, handles)
% hObject handle to limpiargrafica (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%Limpiar la grfica
axes(handles.axes2);
cla reset;
axis on;

% --- Executes on button press in factorial.


function factorial_Callback(hObject, eventdata, handles)
% hObject handle to factorial (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
textstring=strcat(textstring,'factorial(');
set(handles.pantalla,'String',textstring)

% --- Executes on button press in porcentaje.


function porcentaje_Callback(hObject, eventdata, handles)
% hObject handle to porcentaje (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.pantalla,'String');
s=str2double(textstring);
porcentaje=s/100;
t=num2str(porcentaje);
set(handles.pantalla,'String',t)

CAPTURA DE PANTALLA de la calculadora:

Funcin Suma:
Funcin Resta Para borrar la pantalla utilizamos el botn AC:
Funcin Multiplicacin:
Funcin Divisin:
Funcin Seno en grados:
Funcin coseno en grados:
Funcin Tangente en grados:
Funcin elevado al cuadrado:
Funcin elevado al cubo:
Funcin elevado a la n:
Funcin raz cuadrada:
Funcin raz cubica:
Funcin raz n:
Funcin pi:
Funcin e:
Funcin ln:
Funcin log:
Funcin factorial:
Funcin porcentaje de 10:

Funcin Graficar:
Funcin Limpiar grfica y pantalla:

Funcin Regresar:
Funcin Continuar:

Funcin Salir:

Anda mungkin juga menyukai