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

PROGRAMACION CON MATLAB

MC. EMILY SAUCEDO MARISCAL


UANL- FIME
ELEMENTOS DE MATLAB
Manejo de datos, generacin de
vectores
Operadores y su funcin con vectores
Generacin matrices
Funciones matemticas
Graficas 2D y D
Creacin de funciones
Aplicaciones en fisica
Aplicaciones en ingenieria
Aplicaciones en procesado de imagen




MATLAB
Que es Matlab?
Matrix Laboratory

Ambiente amigable y de fcil aprendizaje
Reduccin de tiempo de programacin

El proceso de operaciones con matrices
Cuenta con miles de funciones, con su uso se ahorra
tiempo de programacin

Toolbox
TOOLBOXES
MATLAB Product Family
MATLAB
Parallel Computing Toolbox
MATLAB Distributed Computing
Server

Math and Optimization
Optimization Toolbox
Symbolic Math Toolbox
Partial Differential Equation Toolbox
Global Optimization Toolbox

Statistics and Data Analysis
Statistics Toolbox
Neural Network Toolbox
Curve Fitting Toolbox
Spline Toolbox
Model-Based Calibration Toolbox



Control System Design and Analysis
Control System Toolbox
System Identification Toolbox
Fuzzy Logic Toolbox
Robust Control Toolbox
Model Predictive Control Toolbox
Aerospace Toolbox

Signal Processing and
Communications
Signal Processing Toolbox
Signal Processing Blockset
Communications Toolbox
Filter Design Toolbox
Filter Design HDL Coder
Wavelet Toolbox
Fixed-Point Toolbox
RF Toolbox

Image and Video Processing
Image Processing Toolbox
Video and Image Processing Blockset
Image Acquisition Toolbox
Mapping Toolbox
TOOLBOXES
Test and Measurement
Data Acquisition Toolbox
Instrument Control Toolbox
Image Acquisition Toolbox
SystemTest
OPC Toolbox
Vehicle Network Toolbox

Computational Biology
Bioinformatics Toolbox
SimBiology

Computational Finance
Financial Toolbox
Financial Derivatives Toolbox
Datafeed Toolbox
Fixed-Income Toolbox
Econometrics Toolbox

Application Deployment
MATLAB Compiler
Spreadsheet Link EX
(for Microsoft Excel)

Application Deployment Targets
MATLAB Builder EX
(for Microsoft Excel)
MATLAB Builder NE
(for Microsoft .NET Framework)
MATLAB Builder JA
(for Java language)

Database Connectivity and
Reporting
Database Toolbox
MATLAB Report Generator


SIMULINK
Simulink
Simulink
Simulink Report Generator

Fixed-Point Modeling
Simulink Fixed Point

Event-Based Modeling
Stateflow
SimEvents

Physical Modeling
Simscape
SimMechanics
SimPowerSystems
SimDriveline
SimHydraulics
SimElectronics

Simulation Graphics
Simulink 3D Animation
Gauges Blockset

Control System Design and
Analysis
Simulink Control Design
Aerospace Blockset
Simulink Design Optimization

Signal Processing and
Communications
Signal Processing Blockset
Communications Blockset
RF Blockset
Video and Image Processing
Blockset

SIMULINK
Code Generation
Real-Time Workshop
Real-Time Workshop Embedded
Coder
Stateflow Coder
Simulink HDL Coder
Target Support Package
DO Qualification Kit
(for DO-178)
IEC Certification Kit
(for IEC 61508 and ISO 26262)
Simulink PLC Coder

Rapid Prototyping and HIL
Simulation
xPC Target
xPC Target Embedded
Option
Real-Time Windows Target

Verification, Validation,
and Test
Simulink Verification and
Validation
Simulink Design Verifier
SystemTest
Embedded IDE Link
EDA Simulator Link

INTRODUCCIN A MATLAB:
LA VENTANA DE COMANDOS
Ventana donde introducir los comandos a
ejecutar
el cursor aparece siempre despus del smbolo
>>

Ejemplo: operaciones aritmticas
Introduzca, presionando enter/intro despus del
ultimo carcter
>>9+2
>>9-1
>>9*2
>>9/2

EJERCICIO 1
Evalu las siguientes operaciones
1. 9 (3 + 5) 6/4
2. 9 3 + 5 6/4
3. 0.5 + 4.1 32 2
4. 0.5 + 4.1 3(2 2).


Evale
1. -

2. -

3. -
Evalu las siguientes operaciones con
nmeros complejos

1.(1 + i) + (2 i)
2.(1 + i) (2 i)
3.(1 + i)/(2 i)
4.(1 + i) (1 i)
2+3
8 + 3
4
1+4(1+3)
-5 + 7
3(2+5)
2 3
2
2(3+4) (1+3)
3 +
3(1-3) 8
CREACIN DE VARIABLES
La creacin de una variable numrica en memoria se hace al asignarle
algn valor a un carcter por medio del smbolo =.

Ejemplos

>> a=4
a=
4

>>b=3+i
b=

3+1i

>>c=signal
c=

signal
FUNCIONES DE MATLAB
clc limpia comandos de la ventana

diary almacena la sesion para presentar

dos Ejecuta comandos

format Ajusta el formato de visualizacion para la salida

edit Edita o crea un nuevo m-file

help ayuda
clear remueve todo lo que esta en las ventanas

who, whos lista las variables de la ventana

clf borra las figuras

why quien?
FUNCIONES MATEMTICAS
Trigonometric
acos Inverse cosine; result in radians
acosd Inverse cosine; result in degrees
acosh Inverse hyperbolic cosine
acot Inverse cotangent; result in radians
acotd Inverse cotangent; result in degrees
acoth Inverse hyperbolic cotangent
acsc Inverse cosecant; result in radians
acscd Inverse cosecant; result in degrees
acsch Inverse hyperbolic cosecant
asec Inverse secant; result in radians
asecd Inverse secant; result in degrees
asech Inverse hyperbolic secant
asin Inverse sine; result in radians
asind Inverse sine; result in degrees
asinh Inverse hyperbolic sine
atan Inverse tangent; result in radians
atan2 Four-quadrant inverse tangent
atand Inverse tangent; result in degrees
atanh Inverse hyperbolic tangent

cos Cosine of argument in radians
cosd Cosine of argument in degrees
cosh Hyperbolic cosine
cot Cotangent of argument in radians
cotd Cotangent of argument in degrees
coth Hyperbolic cotangent
csc Cosecant of argument in radians
Cscd Cosecant of argument in degrees
Csch Hyperbolic cosecant
hypot Square root of sum of squares
sec Secant of argument in radians
secd Secant of argument in degrees
sech Hyperbolic secant
sin Sine of argument in radians
sind Sine of argument in degrees
sinh Hyperbolic sine of argument in
radians
tan Tangent of argument in radians
tand Tangent of argument in degrees
Tanh Hyperbolic tangent

FUNCIONES MATEMTICAS
exp Exponential
expm1 Compute exp(x)-1 accurately for small x
log Natural logarithm
log10 Common (base 10) logarithm
log1p Compute log(1+x) accurately for small x
log2 Base 2 logarithm and
dissect floating-point numbers into
exponent and mantissa
nextpow2 Next higher power of 2
nthroot Real nth root of real numbers
pow2 Base 2 power and scale floating-point
numbers
reallog Natural logarithm for nonnegative real
arrays
realpow Array power for real-only output
realsqrt Square root for nonnegative real arrays
sqrt Square root

abs Absolute value and
complex magnitude
angle Phase angle


complex Construct complex data from real and
imaginary components
conj Complex conjugate
cplxpair Sort complex numbers into complex
conjugate pairs
i Imaginary unit
imag Imaginary part of complex number
isreal Determine whether input is real array
j Imaginary unit
real Real part of complex number
sign Signum function
unwrap Correct phase angles to produce
smoother phase plots

ceil Round toward infinity
fix Round toward zero
floor Round toward minus infinity
idivide Integer division with rounding option
mod Modulus after division
rem Remainder after division
round Round to nearest integer
EJERCICIOS 2
Evale las siguientes variables

( )
( )
2 3
2
) 3sin
4
) 3cos
4 2
) sin 0.9
) cos 0.42
) 5sin / 3
)
) ln 7
a y
b y
c
d
e y
f y e
g y e
t
t t
v
v
t
+
| |
=
|
\ .
| |
= +
|
\ .
=
=
=
=
= +
y=exp(2)+sqrt(3)
Despliega grafica del seno en puntos
azules
Despliega grafica del coseno en
diamantes verdes
>>[X, Y]=meshgrid(-2:.2:2,-3:0.5:3)
>>Z=X.^2.*Y
>>plot3(X,Y,Z)
Grficos tridimensionales
CREACIN DE VECTORES
La creacin de un arreglo de datos (vector) se realiza a travs de una operacin para la cual se tienen
las siguientes funciones.

1.Ordenar todos los elementos entre corchetes y asignarlos a la variable

a=[0,1,2,3,4,5,6,7,8,9]

2.Crear una serie de datos con el operador :

a=0:9

3.Crear una serie de datos con el operador : e indicarle el intervalo entre elementos

a=0:1:9

4.Utilizar la funcin linspace

a=linspace(0,9,10)
>>
a=linspace(0,9,10)
a =
0 1 2 3 4 5 6 7 8 9
>> % Arroja valores del 0 al 10
CREACIN DE VECTORES
Ejercicios 3: introduzca los siguientes vectores

| |
| |
| |
) 1, 2,1
1
) 2
1
) 2, 3, 4, , 25
) 20,18, , 18, 20
0.1
0.2
) 0.3
100
T
a a
b b
c c
d d
e e
=
(
(
=
(
(

=
=
(
(
(
( =
(
(
(

>> A=[1 2 1]

A =

1 2 1
OPERACIONES CON VECTORES
sintaxis operacin condicin
A+B
suma Ambos vectores deben tener el mismo numero de
elementos
A-B
resta Ambos vectores deben tener el mismo numero de
elementos.

A*B
multiplicacin Ambos vectores deben tener el mismo numero de
elementos. El producto dependera del tipo de
vectores: rengln (horizontal) o columna (vertical).

A.*B

Multiplicacin
elemento a
elemento

Ambos vectores deben tener el mismo numero de
elementos. Ambos vectores deben ser del mismo
tipo: rengln o columna.

OPERACIONES CON VECTORES
sintaxis operacin condicin
A/B
divisin Es equivalente a B*inv(A). B/A = (A'\B'). Ambos
vectores deben tener el mismo numero de
elementos.
A./B
Divisin elemento
a elemento
La divisin comn aplicada a cada elemento.
Ambos vectores deben tener el mismo numero de
elementos.
A\B
division Es equivalente a inv(A)*B. X=A\B es la solucion
de la ecuacin AX=B calculada por eliminacin
gaussiana

A.\B
Multiplicacion
elemento a
elemento

A.\B = B./A . Ambos vectores deben tener el mismo
numero de elementos.

OPERACIONES CON VECTORES
sintaxis operacin condicin
A^B
exponencial Eleva los elementos de la matriz A a la potencia B.
Eleva A a las potencias de B. Una de las matrices
debe ser escalar.
A.^B
exponencial Eleva los elementos de la matriz A a las potencias
B. Ambos A y B pueden ser matrices, escalare o
combinados
A

transpuesta Calcula la transpuesta de un vector o matriz.
Para matrices complejas esto es el conjugado
complejo de la transpuesta
A.

transpuesta Calcula la transpuesta de un vector o matriz.
Para matrices complejas no implica la
conjugacin
EJERCICIO 4: OPERACIONES CON VECTORES
Introduzca el vector u=[1,2,3,,10], y calcule
1. El producto escalar u
.
u
2. El producto u
T.
u
3. El producto escalar usando el comando dot
4. El producto elemento a elemento u.*u
MATRICES
Crear un arreglo de datos en dos dimensiones (matriz) se
puede llevar a cabo de varias formas

1. Introduciendo cada elemento
A=[1, 2, 3; 4, 5, 6; 7, 8, 9]
>> A=[1, 2, 3; 4, 5, 6; 7, 8, 9]

A =

1 2 3
4 5 6
7 8 9
1. Multiplicando dos vectores, a vector renglon,
entonces a*a es una matriz
2. Crear una matriz de 1s con la funcin ones
>> A=ones(4)

A =

1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
EJERCICIO 5: MATRICES
1. Crear una matriz de ceros con la funcin zeros
2. Crear una matriz diagonal con la funcin diag
3. Crear una matriz identidad con la funcin eye
4. Con la funcin meshgrid comnmente usada
para evaluar funciones de dos o tres variables


MATRICES
Ejercicios: intruduzca las matrices


1 2 1
0 2 1
0 0 3
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
a
b
(
(
=
(
(

(
(
(
=
(
(

1 0 0 0
0 1 0 0
0 0 1 1
0 0 1 1
1 0 1 0 2 2
0 1 1 1 2 2
1 0 3 3 3 1
0 1 3 3 3 1
2 2 3 3 3 1
2 2 1 1 1 4
c
d
(
(
(
=
(
(

(
(
(
(
=
(
(
(
(

MATRICES
EJERCICIO 6
Introduzca




y calcule

a) Ab
b) Bb
c) AB
d) BA
1 0 0 2 1 2 0
1
0 2 0 , 2 2 1 , 1
3
0 0 3 1 2 2 0
A B b
( ( (
( ( (
= = =
( ( (
( ( (

Graficacin

Una vez definidos los vectores de valores x y valores y, Matlab hace fcil la
creacin de graficas. A travs de medicin, se obtiene un conjunto de datos
tiempo con distancia.
Se pueden almacenar los valores de tiempo en un vector llamado x y distancia
como y.

> x=[0:2:18];
>> y=[0,0.33,4.13,6.29,6.85,11.19,13.19,13.96,16.33,18.17];
>> % graficamos x y y
>> plot(x,y)
>>
Podemos agregar ttulos y varias caractersticas

title(' experimento uno')
>> % agregamos ttulo
>> xlabel('tiempo, seg')
>> ylabel('distancia,pies')
>> grid on
>> % grafica con cuadricula

GRAFICAS CON MAS DE UNA LNEA
Podemos aplicar las grficas una encima de la otra
con el comando hold on:

>> x=0:pi/100:2*pi;
>> y1= cos(x*4);
>> plot(x,y1)
>> x=0:pi/100:2*pi;
>> y1= cos(x*4);
>> plot(x,y1)
>> y2=sin(x);
>> hold on;
>> plot(x,y2)
Podemos obtener las graficas en colores
>> x=0:pi/100:2*pi;
>> y1=cos(x)*2;
>> y2=cos(x)*3;
>> y3=cos(x)*4;
>> y4=cos(x)*5;
>> z=[y1;y2;y3;y4];
>> plot(x,y1,x,y2,x,y3,x,y4)

FUNCIN PEAKS
Del ejemplo anterior agregamos:
plot(peaks(100))
El cual peaks es una funcin de dos variables que
produce datos muestra tiles para demostrar ciertas
funciones de graficacin. Se puede usar peaks para
demostrar la potencia de usar un argumento de
matriz en la funcin plot.
La entrada a la funcin plot creada por peaks es una
matriz de 100x100.
MTODO DE GRAFICAR

EJERCICIO 7:

Grafica la funcin de la espiral r=2sen (5u)
Teta=linspace(0,2*pi,1000);
R=2*sin(5teta);
Polar(teta,r)

CREACIN DE NMEROS ALEATORIOS CON
VECTORES





Matriz de 3x3 en nmeros aleatorios

Comando Rand
ACTIVIDAD FUNDAMENTAL I
APLICANDO CAPITULO
DE OPERACIONES BSICAS
ACTIVIDAD FUNDAMENTAL II
APLICANDO TEMA DE VECTORES
Se aplican tres fuerzas en un soporte anclado al
piso (inmvil) fuerza 1 fuerza 2 y 3.
Para considerar un vector tiene que tener magnitud
y direccin.
Aplicando las leyes de Newton, obtener la fuerza
total, la magnitud del vector x e y, y el Angulo
resultante del vector.


Tres leyes de Newton

GRAFICA DE BARRAS
GRAFICAS DE ESCALERA E HISTOGRAMAS Y
PUNTOS
COMANDO SUBPLOT:
SIRVE PARA GUARDAR VARIAS GRAFICAS EN UNA
SOLA FIGURA.
ACTIVIDAD FUNDAMENTAL III
Con las funciones antes realizadas de seno, coseno y tangente,
realizar una figura con las tres graficas y escribir el nombre a la
figura de Actividad Fundamental III. Y a cada grafica el nombre
correspondiente.



RESPUESTA EJERCICIO
Fuerzas 1,2 y 3
2.- Fuerza total
3.- Fuerza resultante
Angulos convertidos a radianes
Componente en x y y(seno y coseno)
Ft en x y ft en y
4.- Angulo del vector
resultante
Inverso de la tan del cociente de la fuerza
generada en x y la fuerza generada en y
de la fuerza total. en que punto del plano
cartesiano se encuentra nuestro vector.
GRAFICA EN TRES DIMENSIONES
UTILIZANDO EL COMANDO PLOT.
Ejemplo 2.11,2.12,2.13.
Libro de Matlab. Baez. 2 Ed.

GRAFICA DE SUPERFICIE (SURF)
Esta grafica es similar a la de malla, excepto que los
rectangulos de la superficie estan coloreados. Los colores de
los rectngulos estn determinados por los valores de Z y por el
mapa de colores
EJERCICIO 8
Introduce el comando y explica que pasa:

Shading flat
Shading interp
Surf
Surf l(X,Y,Z)



GRAFICA DE UNA FUNCIN CON
EZPLOT()
Se utiliza para graficar una funcin definida con el comando
sym().
x = sym ('x') crea la variable simblica con el nombre de 'x' y
almacena el resultado en x. x = sym ('x', 'real') tambin se
supone que x es real, por lo que conj (x) es igual a x. alfa = sym
('alpha') y r = sym ('Rho', 'real') son otros ejemplos.
GRAFICA DE UNA FUNCIN CON
EZPLOT()
-6 -4 -2 0 2 4 6
-3
-2
-1
0
1
2
3
x
cos(10 x) (2+sin(x))
GRAFICA DE UNA FUNCIN CON
FPLOT()
Con la funcin fplot() es posible establecer el intervalo de
la grfica.
-10 -5 0 5 10
-3
-2
-1
0
1
2
3
GRAFICA DE UNA FUNCIN CON
FPLOT()
-30 -20 -10 0 10 20 30
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
VECTOR DE VALORES PARA GRAFICAR UNA
FUNCIN
Esta instruccin indica que los valores
de X empiezan en 0 y se incrementan
en pasos de 0.01 hasta llegar a 2.
VECTOR DE VALORES PARA GRAFICAR UNA
FUNCIN DISCRETA
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
STEM (Y) representa la secuencia de datos Y como se deriva del
eje x terminado con los crculos para el valor de datos. Si Y es una
matriz luego cada columna se representa como una serie
separada.
Entrada de datos
Para leer una cadena se utiliza:
DIFERENCIAS ENTRE PLOT(),
FPLOT() Y EZPLOT()
plot() es una funcin que opera en
forma vectorial.

fplot() y ezplot() son funciones que
trabajan en forma simblica.
LA VARIABLE ALEATORIA GAUSSIANA O NORMAL
La variable aleatoria Gaussiana X es el resultado del Teorema del
limite central.
X es una variable aleatoria que consiste de la suma de un gran
nmero de pequeas variables aleatorias.
Su PDF es dada por:
,
2
1
) (
) 2 /( ) (
2 2
< < =

x e x f
m x
X
o
o t
donde m
y son numeros reales. 0 > o
m
media
o desviacin estndar.
CDIGO DE MATLAB
Funcin Gaussiana distribuida entre -3 y 3, media=0 y desviacin
standard=o=1
-3 -2 -1 0 1 2 3
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
Funcin de densidad de probabilidad
normal normPDf (pdf).
Y = normpdf (x, mu, sigma) devuelve la
funcin de densidad de la distribucin
normal con MU y desviacin estndar
SIGMA, evaluada en los valores de X
Ejercicio 9 transformada Z
2 1
2 1
81 . 0 2732 . 1 1
| ) ( |


+

=
z z
z z
z X
Grafica de la magnitud de la Transformada Z de la funcin:
Grficas de superficies
Los coeficientes de los polinomios estn
definidos en MATLAB como vectores
rengln donde los coeficientes se escriben
en orden descendente
1 + = x y
1 6 3
2 3
+ + = x x y
OPERACIONES BSICAS DE POLINOMIOS
OPERACIONES BSICAS DE POLINOMIOS
Operaciones: Suma y resta

[ 1 1 1 1 ] + [ 3 2 1 0 ]

ans =
4 3 2 1 % = 4x3 + 3x2 + 2x + 1

Ambas representaciones deben ser de
igual largo (cantidad de elementos)!

% (x + 1) + (3x3 + 2x2 + x)
[ 0 0 1 1 ] + [ 3 2 1 0 ]
ans =

3 2 2 1 % la resta es anloga
Operaciones: Producto

Polinomio x escalar

[ 3 2 1 0 ] * 3 % (3x3 + 2x2 + x) 3

ans =
9 6 3 0 % 9x3 + 6x2 + 3x
MULTIPLICACIN DE POLINOMIOS
Se utiliza la funcin conv()
1 6 9 3
2 3 4
+ + + + = x x x x y
1 + = x y
1 6 3
2 3
+ + = x x y
MULTIPLICACIN DE POLINOMIOS
Para multiplicar ms de dos polinomios es necesario
repetir el proceso.
x x x x x x x x x x y 32 60 20 23 42 18 12 9 2 5
2 3 4 5 6 7 8 9 10
+ =
POLINOMIOS
14 3 2
2
+ + = x x y
Para evaluar un polinomio se utiliza la
funcin polyval()
DIVISIN DE POLINOMIOS
9 4 3
2 3
+ + + x x x
3 + x
16 5 3
2
+ x x
2 3
9 3 x x
9 5
2
+ + x x
x x 15 5
2
+
9 16 + x
48 16 x
39
cociente
residuo
DIVISIN DE POLINOMIOS
Se utiliza la funcin
[ q, r ]= deconv(a,b)



q: polinomio cociente



r: polinomio residuo
DERIVADA DE UN POLINOMIO
Se utiliza la instruccin: polyder()
1 6 9 3
2 3 4
+ + + + = x x x x y
1 12 27 12
2 3
+ + + = x x x y
Operaciones: polyder()

polyder ( [ 4 2 1 ]) ( [ 4 2 1 ])
ans =
8 2
INTEGRAL DE UN POLINOMIO
Operaciones: polyint() integra un polinomio
polyint ([4,2])
ans =
2 2 0

ACTIVIDAD FUNDAMENTAL IV
Resuelva las siguientes operaciones, para los polinomios.
a)2
3
+4
2
+2
b)5
5
+7
3
+9
c)8
3
+4
2

d)3
2
+10


1.- suma los polinomios a+b y c+d
2.- resta a-d y b-c
3.- multiplica a*b
4.- divide a/d
5.- deriva cada polinomio
6.- integra cada polinomio
Examen de
medio curso
VARIABLES Y FUNCIONES
AJUSTE DE CURVAS
Para expresar datos por medio de un polinomio,
Matlab utiliza la instruccin polyfit(,x,y,n).
x,y: son los vectores de datos.
n: es el orden del polinomio

EJEMPLO
X 0 1 2 3 4 5 6
Y 0 -4 -5 2 6 -4 10
Considerar los datos de la siguiente tabla y obtener la grfica
Esto indica el polinomio a(x)= -.0278
3
+.7143
2
1.8770
1
1.1905
EJERCICIO 1
Con los datos siguientes obten:
a) La grfica
b) La grafica de un polinomio de grado 3 pasando
por los puntos obtenidos.
c) La grafica de los puntos junto con los polinomios.

x
Datos medidos
y
0 0
1 1
2 4
3 2.5
4 8
5 3
6 .23
CONTINUACION DEL EJEMPLO ANTERIOR


Ahora se utiliza un polinomio de grado 6.
Ajuste de curvas
Ajuste de curvas
AJUSTE DE CURVAS CON LA FUNCIN
SPLINE(X,Y,V)
Esta funcin est formada por varios polinomios de 3er
grado.
x, y: coordenadas de los puntos.
V: vector de puntos por donde
quisiramos que el spline yt tomara los
valores del vector y.
AJUSTE DE CURVAS CON LA FUNCIN
SPLINE(X,Y,V)
Se observa que la funcin spline() da mejores
resultados.
INTERFASE PARA AJUSTE DE CURVAS
BASIC FITTING
- Primero graficar los datos x, y.
- En el menu Tools, seleccionar Basic Fitting.
- Seleccionar la opcin Spline Interpolant.
- Seleccionar la opcin 5th degree polynomial.
- Seleccionar show equations.
- Plot residuals muestra el error en cada
aproximacin.
- La siguiente ventana muestra los coeficientes de
los polinomios.
- La ltima ventana permite evaluar el polinomio.
INTERFASE PARA AJUSTE DE CURVAS
BASIC FITTING
INTERFASE PARA AJUSTE DE CURVAS
BASIC FITTING
INTERFASE PARA AJUSTE DE CURVAS
BASIC FITTING
SOLUCIN DE ECUACIONES
Para resolver ecuaciones Matlab utiliza la instruccin
solve().
SOLUCIN DE ECUACIONES
En algunos casos Matlab arroja un valor numerico.
INTEGRALES
La operacin de integracin indefinida de una
funcin f(x) se denota:
F= int(f)=


Donde la nueva funcin F satisface que:
diff(F)= f(x)
F se conoce tambin como la antiderivada de f y
MATLAB la encontrar siempre que exista.
la instruccin quad se puede usar para integrar
numricamente una funcin.
Su formato quad( funcion,a,b), donde funcion es la
definicin de la funcin que deseamos integrar y a y
b son los lmites.
EJEMPLOS
a)F= int(f) =



c)

()/

0

b)F= int(f) =

2
1
0

INTEGRALES DOBLES Y TRIPLES
Ejercicio: escribir la integral a la que corresponde
cada resultado de matlab
a)
b)
PROGRAMACION BASICA CON MATLAB

Realizar los programas propuestos por el maestro
APLICACIONES CON MATLAB:
PROCESAMIENTO DE IMAGEN
EJEMPLO: AUMENTO DE CONTRASTE
ACTIVIDAD 2
OPERACIONES BSICAS LGICAS
Suma:

EXAMEN ORDINARIO

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