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

UNIVERSIDAD PRIVADA DEL VALLE AUTOMATIZACION Y CONTROL

Nombre: Marco Antonio Oliver Zapata Titulo: Programacion en Matlab


Materia: Automatizacion y Control Fecha: 20/08/18
N° de Grupo: Grupo N°1 Tipo de Documento: Pre – Informe #1

PROGRAMACION EN MATLAB
ANTECEDENTES:

MATLAB (abreviatura de MATrix LABoratory, "laboratorio de matrices") es una


herramienta de software matemático que ofrece un entorno de desarrollo integrado
(IDE) con un lenguaje de programación propio (lenguaje M). Está disponible para
las plataformas Unix, Windows, Mac OS X y GNU/Linux . Entre sus prestaciones
básicas se hallan: la manipulación de matrices, la representación de datos y
funciones, la implementación de algoritmos, la creación de interfaces de usuario
(GUI) y la comunicación con programas en otros lenguajes y con otros dispositivos
hardware. El paquete MATLAB dispone de dos herramientas adicionales que
expanden sus prestaciones, a saber, Simulink (plataforma de simulación
multidominio) y GUIDE (editor de interfaces de usuario - GUI). Además, se pueden
ampliar las capacidades de MATLAB con las cajas de herramientas (toolboxes); y
las de Simulink con los paquetes de bloques (blocksets). Es un software muy usado
en universidades y centros de investigación y desarrollo. En los últimos años ha
aumentado el número de prestaciones, como la de programar directamente
procesadores digitales de señal o crear código VHDL. En 2004, se estimaba que
MATLAB era empleado por más de un millón de personas en ámbitos académicos
y empresariales. Las aplicaciones de MATLAB se desarrollan en un lenguaje de
programación propio. Este lenguaje es interpretado, y puede ejecutarse tanto en el
entorno interactivo, como a través de un archivo de script (archivos *.m). Este
lenguaje permite operaciones de vectores y matrices, funciones, cálculo lambda, y
programación orientada a objetos. Durante mucho tiempo hubo críticas porque
MATLAB es un producto propietario de The Mathworks, y los usuarios están sujetos
y bloqueados al vendedor. Recientemente se ha proporcionado una herramienta
Página 1|9
UNIVERSIDAD PRIVADA DEL VALLE AUTOMATIZACION Y CONTROL

adicional llamada MATLAB Builder bajo la sección de herramientas "Application


Deployment" para utilizar funciones MATLAB como archivos de biblioteca que
pueden ser usados con ambientes de construcción de aplicación .NET o Java. Pero
la desventaja es que el computador donde la aplicación tiene que ser utilizada
necesita MCR(MATLAB Component Runtime) para que los archivos MATLAB
funcionen correctamente. MCR se puede distribuir libremente con los archivos de
biblioteca generados por el compilador MATLAB.

OBJETIVO:

- Desarrollar herramienta que permita realizar operaciones matriciales


empleando Matlab.
-

MARCO TEORICO:

Esta y todas las dem´as pr´acticas est´an pensadas para ser trabajadas delante de
un ordenador con MATLAB instalado, y no para ser leıdas como una novela. En vez
de eso, cada vez que se presente un comando de MATLAB, se debe introducir el
comando, pulsar la tecla “Enter” para ejecutarlo y ver el resultado. Mas aun, se
desea que se verifique el resultado. Asegurese de que se comprende perfectamente
lo que se obtiene antes de continuar con la lectura. Aunque MATLAB es un entorno
que trabaja con matrices, en esta practica se aprender a como introducir vectores
por filas o por columnas y a manejar algunas operaciones con vectores. Un vector
se define introduciendo los componentes, separados por espacios o por comas,
entre corchetes:

» v=[sqrt(3) 0 -2]

v=

1.7321 0 -2.0000

Para definir un vector columna, se separan las filas por puntos y comas:

Página 2|9
UNIVERSIDAD PRIVADA DEL VALLE AUTOMATIZACION Y CONTROL

» w=[1;0;1/3]

w=

1.0000

0.3333

La operación transponer (cambiar filas por columnas) se designa por el apóstrofe:

» w'

ans =

1.0000 0 0.3333

Las operaciones matemáticas ele

456

789

Para referirse a un elemento de la matriz se hace así:

» M(3,1)

ans =

Para referirse a toda una fila o a toda una columna se emplean los dos

puntos:

» v1=M(:,2)

v1 =

8
Página 3|9
UNIVERSIDAD PRIVADA DEL VALLE AUTOMATIZACION Y CONTROL

(v1 es la segunda columna de M).

Con las matrices también funcionan las operaciones matemáticas

elementales. Así

» M^2

ans =

30 36 42

66 81 96

102 126 150

Si se quiere operar en los elementos de la matriz, uno por uno, se pone un punto
antes del operador. Si se quiere elevar al cuadrado cada uno de los elementos de
M, entonces

» M.^2

ans =

149

16 25 36

49 64 81

Algunas funciones definidas sobre matrices:

det determinante inv matriz inversa poly polinomio característico ' transpuesta.

APLICACIÓN:

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

function final_OpeningFcn(hObject, eventdata, handles, varargin)

a=imread('logo2.png');

image(a)

Página 4|9
UNIVERSIDAD PRIVADA DEL VALLE AUTOMATIZACION Y CONTROL

axis off

% Choose default command line output for final

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

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

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = final_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;

Página 5|9
UNIVERSIDAD PRIVADA DEL VALLE AUTOMATIZACION Y CONTROL

% --- Executes on button press in determinante.

function determinantes_Callback(hObject, eventdata, handles)

valor=get(handles.matriz,'string');

valor=str2num(valor);

if (valor == valor)

determinantes =det(valor);

set(handles.vista,'string',num2str(determinantes));

else

set(handles.vista,'string',('No es una matriz cuadrada'));

end

function matriz_Callback(hObject, eventdata, handles)

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

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

% double

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

function matriz_CreateFcn(hObject, eventdata, handles)

% hObject handle to matriz (see GCBO)


Página 6|9
UNIVERSIDAD PRIVADA DEL VALLE AUTOMATIZACION Y CONTROL

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

% handles empty - handles not created until after all CreateFcns called

% Hints: 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 inversa.

function inversa_Callback(hObject, eventdata, handles)

valor=get(handles.matriz,'string');

valor=str2num(valor);

if (valor == valor)

inversa=inv(valor);

set(handles.vista,'string',num2str(inversa));

else

set(handles.vista,'string',('No es una matriz cuadrada'));

end

% --- Executes on button press in transpuesta.

Página 7|9
UNIVERSIDAD PRIVADA DEL VALLE AUTOMATIZACION Y CONTROL

function transpuesta_Callback(hObject, eventdata, handles)

valor=get(handles.matriz,'string');

valor=str2num(valor);

trans=transpose(valor);

set(handles.vista,'string',num2str(trans));

% --- Executes on button press in adjunta.

function adjunta_Callback(hObject, eventdata, handles)

valor=get(handles.matriz,'string');

valor=str2num(valor);

adjunta=det(valor)*inv(valor);

set(handles.vista,'string',num2str(adjunta));

%-----------------------------------------------------------------------

function vista_Callback(hObject, eventdata, handles)

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

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

Página 8|9
UNIVERSIDAD PRIVADA DEL VALLE AUTOMATIZACION Y CONTROL

BIBLIOGRAFIA:

- https://laboratoriomatematicas.uniandes.edu.co/archivos/Matrices%20Matla
b.pdf
- Wikipedia.org

Página 9|9

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