Вы находитесь на странице: 1из 18

UNIVERSIDAD CATLICA DE SANTA MARIA

FACULTAD: CIENCIAS E INGENIERIAS Y FORMALES

PROGRAMA PROFECIONAL: ING MECANICA, MECANICA ELECTRICA Y

MECATRONICA

CURSO:

TECNOLOGIA AUTOMOTRIZ II

GRUPO:

TEMA:

CODIGOS DE MATLAB

ALUMNO:

MOLLO GONZALES ELVIS

AREQUIPA PERU

2015
FUNCION POTENCIA

clear all;

clc;

disp('cacular la suma de el cuadrado enesimo de un numero mayor igual a cero');

x=input('ingrese el numero a sumar sus cuadrados, x =');

n=input('ingrese el termino enesimo, n = ');

p=1;

h=0;

f=1;

if n>0

while p<=n

if x>0

f=x*f;

p=p+1;

h=h+f;

else

h=h*0;

p=p+1;

end

end

d=h+1;

fprintf('la potencia es %0.2f\n', d);

else

fprintf('la potencia es %0.2f\n', p);

end
CALCULADORA:

function varargout = calculadora(varargin)

% CALCULADORA M-file 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 25-Sep-2015 05:21:36


% 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;

% 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;

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '1');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '2');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '3');

set(handles.pantalla,'String',textopantalla);
% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '4');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '5');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '6');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '7');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '8');

set(handles.pantalla,'String',textopantalla);
% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '9');

set(handles.pantalla,'String',textopantalla);

% --- Executes on button press in borrar.

function borrar_Callback(hObject, eventdata, handles)

% hObject handle to borrar (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

b=char('');

c=get(handles.pantalla,'String');

set(handles.pantalla,'String',b);

for i=1:length(c)-1

a=c(i);

b=strcat(b,a);

end

set(handles.pantalla,'String',b);

% --- 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)

set(handles.pantalla,'String','');

% --- Executes on button press in suma.

function suma_Callback(hObject, eventdata, handles)

% hObject handle to suma (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '+');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '-');

set(handles.pantalla,'String',textopantalla);
% --- Executes on button press in multiplicacion.

function multiplicacion_Callback(hObject, eventdata, handles)

% hObject handle to multiplicacion (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '*');

set(handles.pantalla,'String',textopantalla);

% --- Executes on button press in divicion.

function divicion_Callback(hObject, eventdata, handles)

% hObject handle to divicion (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '/');

set(handles.pantalla,'String',textopantalla);

% --- 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)


textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, 'sin(');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=eval(textopantalla);

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '.');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '0');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, 'pi');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, 'sqrt');
set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '(');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, ')');

set(handles.pantalla,'String',textopantalla);

% --- Executes on button press in logaritmo.

function logaritmo_Callback(hObject, eventdata, handles)

% hObject handle to logaritmo (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB


% handles structure with handles and user data (see GUIDATA)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, 'log10(');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, 'tan(');

set(handles.pantalla,'String',textopantalla);

% --- 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)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, 'cos(');

set(handles.pantalla,'String',textopantalla);

% --- Executes on button press in logaritmoNatural.


function logaritmoNatural_Callback(hObject, eventdata, handles)

% hObject handle to logaritmoNatural (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, 'log(');

set(handles.pantalla,'String',textopantalla);

% --- Executes on button press in potencia.

function potencia_Callback(hObject, eventdata, handles)

% hObject handle to potencia (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

textopantalla=get(handles.pantalla,'String');

textopantalla=strcat(textopantalla, '^');

set(handles.pantalla,'String',textopantalla);

% --- Executes on button press in pushbutton30.

function pushbutton30_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton30 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)


% --- Executes when uipanel1 is resized.

function uipanel1_ResizeFcn(hObject, eventdata, handles)

% hObject handle to uipanel1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in grafica.

function grafica_Callback(hObject, eventdata, handles)

% hObject handle to grafica (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

axes(handles.axes1);

graf=get(handles.pantalla,'String');

hold on

ezplot(graf)

grid on

hold off

% --- 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)

textopantalla=get(handles.pantalla,'String');
textopantalla=strcat(textopantalla, 'x');

set(handles.pantalla,'String',textopantalla);

Вам также может понравиться