0% found this document useful (0 votes)
48 views6 pages

'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'

The document contains the code for a GUI application written in MATLAB. It defines functions for initializing the GUI, handling events and callbacks, and performing calculations on user-input equations including taking derivatives and calculating the derivative of an angle. The GUI allows users to input equations, select an operation like taking the derivative, and displays the result.

Uploaded by

Jorge Cayo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views6 pages

'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'

The document contains the code for a GUI application written in MATLAB. It defines functions for initializing the GUI, handling events and callbacks, and performing calculations on user-input equations including taking derivatives and calculating the derivative of an angle. The GUI allows users to input equations, select an operation like taking the derivative, and displays the result.

Uploaded by

Jorge Cayo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

function varargout = Principal(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Principal_OpeningFcn, ...
'gui_OutputFcn', @Principal_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

function Principal_OpeningFcn(hObject, eventdata, handles, varargin)


handles.output = hObject;
guidata(hObject, handles);

function varargout = Principal_OutputFcn(hObject, eventdata, handles)


varargout{1} = handles.output;

function togglebutton1_Callback(hObject, eventdata, handles)

function pushbutton1_Callback(hObject, eventdata, handles)

function pushbuttonSalir_Callback(hObject, eventdata, handles)


close;

function txtcomponente_i_Callback(hObject, eventdata, handles)

function txtcomponente_i_CreateFcn(hObject, eventdata, handles)


if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function txtcomponente_j_Callback(hObject, eventdata, handles)

function txtcomponente_j_CreateFcn(hObject, eventdata, handles)


if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in btnpridev.


function btnpridev_Callback(hObject, eventdata, handles)
i=get(handles.txtcomponente_i,'String');
j=get(handles.txtcomponente_j,'String');
syms t;
di=diff(i,t);
dj=diff(j,t);
set(handles.mostrard1i,'string',char(di));
set(handles.mostrard1j,'string',char(dj));

% --- Executes on button press in btnsegdev.


function btnsegdev_Callback(hObject, eventdata, handles)
i2=get(handles.txtcomponente_i,'String');
j2=get(handles.txtcomponente_j,'String');
syms t;
di2=diff(i2,t,2);
dj2=diff(j2,t,2);
set(handles.mostrard2i,'string',char(di2));
set(handles.mostrard2j,'string',char(dj2));

% --- Executes on button press in btnlimpiar.


function btnlimpiar_Callback(hObject, eventdata, handles)
set(handles.txtcomponente_i,'String','');
set(handles.txtcomponente_j,'String','');
set(handles.mostrard1i,'String','');
set(handles.mostrard1j,'String','');
set(handles.mostrard2i,'String','');
set(handles.mostrard2j,'String','');
set(handles.result,'String','');

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


function fondo_CreateFcn(hObject, eventdata, handles)
a=imread('fondo.jpg');
image(a)
axis off

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


function espe_CreateFcn(hObject, eventdata, handles)
b=imread('espe.jpg');
image(b)
axis off

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


function software_CreateFcn(hObject, eventdata, handles)
s=imread('software.jpg');
image(s)
axis off

% --- Executes on selection change in popupmenu2.


function popupmenu2_Callback(hObject, eventdata, handles)
p=get(hObject,'Value');
if(p==2)
i=get(handles.txtcomponente_i,'String');
j=get(handles.txtcomponente_j,'String');
syms t;
di=diff(i,t);
dj=diff(j,t);
multi=i*di;
multj=j*dj;
set(handles.result,'string',strcat(char(multi),char(' i +
'),char(multj),char(' j')));
else
if(p==3)
i=get(handles.txtcomponente_i,'String');
j=get(handles.txtcomponente_j,'String');
syms t;
a=i.^2;
b=j.^2;
sum=a+b;
raiz=sqrt(sum);
total=diff(raiz,t);
set(handles.result,'string',char(total));
else
if(p==4)
i=get(handles.txtcomponente_i,'String');
j=get(handles.txtcomponente_j,'String');
syms t;
di=diff(i,t);
dj=diff(j,t);
di2=diff(i,t,2);
dj2=diff(j,t,2);
multi=di.*di2;
multj=dj.*dj2;
producto=multi.^2.+multj.^2;
resp=diff(producto,t);
set(handles.result,'string',char(resp));
end
end
end

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


function popupmenu2_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in btnteta.


function btnteta_Callback(hObject, eventdata, handles)
diffangulo

function varargout = diffangulo(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @diffangulo_OpeningFcn, ...
'gui_OutputFcn', @diffangulo_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

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


function diffangulo_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% --- Outputs from this function are returned to the command line.
function varargout = diffangulo_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function gci_Callback(hObject, eventdata, handles)

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


function gci_CreateFcn(hObject, eventdata, handles)

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


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function gcj_Callback(hObject, eventdata, handles)

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


function gcj_CreateFcn(hObject, eventdata, handles)

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


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

function fci_Callback(hObject, eventdata, handles)

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


function fci_CreateFcn(hObject, eventdata, handles)

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


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

function fcj_Callback(hObject, eventdata, handles)

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


function fcj_CreateFcn(hObject, eventdata, handles)

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


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

% --- Executes on button press in btncalculat.


function btncalculat_Callback(hObject, eventdata, handles)
fi=get(handles.fci,'String');
fj=get(handles.fcj,'String');
gi=get(handles.gci,'String');
gj=get(handles.gcj,'String');
syms t;
modulof=sqrt(fi.^2+fj.^2);
modulog=sqrt(gi.^2.+gj.^2);
operacion=((fi.*gi)+(fj.*gj))/(modulof.*modulog);
ang=1/cos(operacion);
total=diff(ang,t);
set(handles.respuesta,'string',char(total));

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


function fondo_CreateFcn(hObject, eventdata, handles)
a=imread('fondo.jpg');
image(a)
axis off

% --- Executes on button press in limpiar.


function limpiar_Callback(hObject, eventdata, handles)
set(handles.fci,'String','');
set(handles.fcj,'String','');
set(handles.gci,'String','');
set(handles.gcj,'String','');
set(handles.respuesta,'String','');

You might also like