TA1-Alfredo Aguilar Leon

Descargar como docx, pdf o txt
Descargar como docx, pdf o txt
Está en la página 1de 5

Alfredo Aguilar Leon

function pushbutton2_Callback(hObject, eventdata, handles)

set(handles.e,'string','');

set(handles.x1,'string','');

set(handles.x2,'string','');

set(handles.x3,'string','');

set(handles.err,'string','');

set(handles.s1,'string','');

set(handles.s2,'string','');

set(handles.s3,'string','');

ELIMINAR
function popupmenu1_Callback(hObject, eventdata, handles)

%ESE NECESARIO CREAR UN POP UP MENU Y EL GLOBAL PARA PODER OBTENER EL VALOR

%DESDE OTRA FUNCION

global metodo

contenido = get(hObject,'string');

a = get(hObject,'value');

tipo = contenido(a);

metodo = cell2mat(tipo);

pop up menu

function pushbutton1_Callback(hObject, eventdata, handles)

global metodo

%CREAMOS LAS MATRICES DE NUESTRO PROBLEMA

M1 = [10 2 -1; -3 -6 2; 1 1 5];

R = [27; -61.5; -21.5];

switch metodo

case 'ELIMINACION DE GAUSS'

%CON LAS MATRICES INGRESADAS DE NUESTRO PROBLEMA DESARROLLAMOS.

AB = [M1 R];

R = rref(AB);

x = R(:,4);

case'MATRIZ INVERSA'

%DEBEMOS CALCULAR LA DETERMINANTE

if det(M1)~=0

a=inv(M1)*R;

%ES NECESARIO COLOCAR UNA CONDICIÓN

else
disp('no hay inversa');

end

x = a(:,1);

case'LU'

[L U]=lu(M1);

D=(L^-1)*R;

T=(U^-1)*D;

%COMO SE SABE CUANDO UNA FUNCION SE IGUALA, AL TERMINAR LA FUNCION DEBE

%DEVOLVER UN VALOR

x = T(:,1);

case'JACOBI Y GAUSS'

%DEBEMOS PEDIR LOS DATOS QUE NECESITAMOS, ERROR, SEMILLA 1, 2 Y 3

e = eval(get(handles.e,'string'));

x1 = eval(get(handles.s1,'string'));

x2 = eval(get(handles.s2,'string'));

x3 = eval(get(handles.s3,'string'));

i=1;

error(i)=10;

while error(i)>e

%DEBEMOS TENER EN CUENTA LA ECUACIÓN DE NUESTRO PROBLEMA

x1(i+1)=(27-2*x2(i)+x3(i))/10;

x2(i+1)=(61.5-3*x1(i)+2*x3(i))/6;

x3(i+1)= (-21.5-x1(i)-x2(i))/5;

A=[abs(x1(i+1)-x1(i)),abs(x2(i+1)-x2(i)),abs(x3(i+1)-x3(i))];

error(i+1)=max(A);

i=i+1;

end
%DEBEMOS RETORNAR UN VALOR

x = [x1(i); x2(i); x3(i); error(i)];

set(handles.err,'string',x(4,1));

end

set(handles.x1,'string',x(1,1));

set(handles.x2,'string',x(2,1));

set(handles.x3,'string',x(3,1));

Funcion principal

unction problemin_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 problemin (see VARARGIN)

% Choose default command line output for problemin

handles.output = hObject;
% Update handles structure

guidata(hObject, handles);

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

% uiwait(handles.figure1);

guidata(hObject, handles);

ima = imread('problemin.jpg');

axes(handles.Problema);

imshow(ima);

Para imagen

También podría gustarte

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy