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

UNIVERSIDAD NACIONAL DE INGENIERÍA

FACULTAD DE CIENCIAS Y SISTEMAS


DEPARTAMENTO DE INFORMÁTICA

MATLAB

I SEMESTRE 2017
Contenido:
TEMA 1: INTRODUCCIÓN
TEMA 2: CÁLCULOS BÁSICOS
TEMA 3: VARIABLES
TEMA 4: FUNCIONES MATEMÁTICAS BÁSICAS
TEMA 5: NÚMEROS COMPLEJOS
TEMA 6: VECTORES
TEMA 7: MATRICES
TEMA 8: CÁLCULOS ALGEBRAICOS
TEMA 9: CÁLCULO DIFERENCIAL E INTEGRAL
TEMA 10: GRÁFICOS

2
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Espacio de trabajo
Se guardan las
variables usadas.
Ventana de comandos
Carpeta de Se ejecutan comandos y se obtienen resultados.

trabajo actual
Se guardan los
archivos (scripts).

Historial de
comandos
Se guardan los
comandos ejecutados.

3
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Espacio de trabajo
Se guardan las
variables usadas.
Ventana de comandos
Carpeta de Se ejecutan comandos y se obtienen resultados.

trabajo actual
Se guardan los
archivos (scripts).

Historial de
comandos
Se guardan los
comandos ejecutados.

4
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Para limpiar la ventana de comandos,


se utiliza el comando clc.

5
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Para limpiar la ventana del área de


trabajo, se utiliza el comando clear.

6
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Para limpiar la ventana del historial de comandos, hacer


click derecho en la ventana y seleccionar Clear
Command History y confirmar la acción.

7
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Al crear variables se muestran en el


espacio de trabajo, con sus valores y
propiedades.

Para crear variables, tenemos que inicializarlas. De lo


contrario, Matlab no las reconocerá.
Una vez creadas las variables, podemos utilizarlas y
operacionalizarlas.

8
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Para mostrar el valor de una variable, solamente


se pone su nombre.

9
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

El área de la carpeta actual, muestra la


ubicación en la que se guardarían los archivos
que vayamos a crear con Matlab.
De manera predeterminada la carpeta actual es
la carpeta:
C:\Program Files\MATLAB\R2011a\bin
Sin embargo, para poder guardar algún archivo
ahí, Windows nos va a denegar el permiso para
hacerlo. Por lo cual, se recomienda cambiar la
ubicación de la carpeta actual a una carpeta de
uso personal sobre la cual tengamos permiso
para agregar archivos, por ejemplo:
C:\Users\Danilo\Desktop
10
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

En los ejemplos anteriores se mostró cómo


crear variables numérica. También podemos
crear vectores, a como se muestra en el
ejemplo. Es una vector lista, en el que se
definen los valores mínimo (0) y máximo (1), así
como también el paso (0.1) para llegar del
mínimo al máximo. Observar el valor de la
variable x en el espacio de trabajo. Indica que es
un vector de 1x11 (1 fila y 11 columnas).
Notar que se puso un ; al final del comando.
Esto le indica a Matlab que no muestre a
continuación lo que genera el comando.
11
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Con Matlab también podemos hacer gráficos.


Una herramienta para graficar es el comando
plot a como se muestra en el ejemplo. Se
especifica los datos del eje X (valores de la
variable x) y los datos del eje Y (función seno de
los valores de l variable x).
Luego de ejecutar el comando plot aparece una
ventana con la gráfica.

12
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

En ejemplo se muestra la definición de otro


vector lista y. Luego se grafica los valores de y
contra el seno de los valores de y.
Se genera la gráfica mostrada en el ejemplo.

13
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Para guardar en un archivo los comandos que


necesitamos para realizar algún cálculo o
gráfico, lo hacemos desde la ventana de la
carpeta actual, haciendo click en el botón del
engranaje, New File, Script. Luego manda a
ponerle un nombre al archivo con extensión .m Luego para abrir y editar el archivo, hacemos
click derecho encima y click en Open, y se abrirá
la ventana del Editor de scripts.
14
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

Aquí en el Editor de scripts podemos ingresar


todos los comandos para realizar algún cálculo o Ejemplo de un script.
gráfico. Para luego guardar los cambios y Podemos ejecutar
ejecutar el archivo. presionando F5 desde
el Editor de script.

15
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
INTERFAZ GRÁFICA DE USUARIO

También podemos
hacerlo desde la
ventana de comandos,
llamando el archivo del
Aquí podemos ver las
script por su nombre.
variables creadas en
Inmediatamente se
script (var1, var2 y
ejecuta el script.
resultado) con sus
También podemos valores respectivos.
ejecutar el archivo de
script desde la ventana
de la carpeta actual.

16
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
AYUDA EN MATLAB

Para acceder a la ayuda


de Matlab,
presionamos F1. Es una
ayuda muy extensa y
completa sobre todo lo
relacionado con
Matlab.
Desde acá podemos
hacer búsquedas
específicas.

17
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
AYUDA EN MATLAB

Otro lugar donde se puede encontrar


ayuda es en la ventana de comandos,
haciendo click sobre el botón fx. Desde ahí
se puede realizar búsquedas específicas
también.

18
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 1:INTRODUCCIÓN
AYUDA EN MATLAB

Otra forma de obtener ayuda de Matlab es


ejecutando el comando help y a
continuación el comando del cual se desea
obtener ayuda.

19
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 2:CÁLCULOS BÁSICOS
ARITMÉTICA BÁSICA Y ORDEN DE LAS OPERACIONES

20
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 2:CÁLCULOS BÁSICOS
EXPONENTES Y NOTACIÓN CIENTÍFICA

21
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 2:CÁLCULOS BÁSICOS
FRACCIONES Y HERRAMIENTAS DE MATEMÁTICA SIMBÓLICA

22
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 2:CÁLCULOS BÁSICOS
FRACCIONES Y HERRAMIENTAS DE MATEMÁTICA SIMBÓLICA

23
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 2:CÁLCULOS BÁSICOS
FRACCIONES Y HERRAMIENTAS DE MATEMÁTICA SIMBÓLICA

24
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
DEFINICIÓN Y USO DE VARIABLES

25
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
DEFINICIÓN Y USO DE VARIABLES

26
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
DEFINICIÓN Y USO DE VARIABLES

27
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
AGREGAR COMENTARIOS AL CÓDIGO MATLAB

28
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
AGREGAR COMENTARIOS AL CÓDIGO MATLAB

29
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
LIMPIAR VARIABLES DEL ESPACIO DE TRABAJO

30
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
AJUSTAR LA PRECISIÓN CON LA QUE SE MUESTRAN LOS CÁLCULOS

31
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
CREAR Y ALMACENAR VALORES EN VARIABLES SIMBÓLICAS

32
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
CREAR Y ALMACENAR VALORES EN VARIABLES SIMBÓLICAS

33
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 3:VARIABLES
REALIZAR CÁLCULOS CON VARIABLES SIMBÓLICAS

34
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 4:FUNCIONES MATEMÁTICAS BÁSICAS
FACTORIAL, RAÍCES CUADRADAS, Y RAÍCES N-ÉSIMAS

35
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 4:FUNCIONES MATEMÁTICAS BÁSICAS
FUNCIONES TRIGONOMÉTRICAS Y SUS INVERSAS

36
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 4:FUNCIONES MATEMÁTICAS BÁSICAS
FUNCIONES TRIGONOMÉTRICAS Y SUS INVERSAS

37
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 4:FUNCIONES MATEMÁTICAS BÁSICAS
EXPONENCIALES Y LOGARITMOS

38
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 5: NÚMEROS COMPLEJOS
CÁLCULOS BÁSICOS CON NÚMEROS COMPLEJOS

39
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 5: NÚMEROS COMPLEJOS
CÁLCULO DE LA MAGNITUD Y ÁNGULO DE NÚMEROS COMPLEJOS

40
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 5: NÚMEROS COMPLEJOS
CÁLCULO DE LA MAGNITUD Y ÁNGULO DE NÚMEROS COMPLEJOS

41
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 5: NÚMEROS COMPLEJOS
FUNCIONES TRIGONOMÉTRICAS, LOGARITMOS Y EXPONENCIALES CON NÚMEROS COMPLEJOS

42
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 5: NÚMEROS COMPLEJOS
NÚMEROS COMPLEJOS Y LA CAJA DE HERRAMIENTAS SIMBÓLICAS

43
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
CREAR VECTORES Y EXTRAER COMPONENTES

44
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
CREAR VECTORES Y EXTRAER COMPONENTES

45
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
CREAR VECTORES Y EXTRAER COMPONENTES

46
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
SUMAR Y RESTAR VECTORES Y MULTIPLICAR VECTORES CON UN ESCALAR

47
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
CÁLCULO DEL VECTOR PRODUCTO PUNTO (ESCALAR) Y PRODUCTO CRUZADO

48
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
MEDIA, SUMA Y LONGITUD DE UN VECTOR

49
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
EXTRAER UN SUBCONJUNTO DE ELEMENTOS DE UN VECTOR

50
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
CREAR VECTORES CON ELEMENTOS EQUITATIVAMENTE ESPACIADOS

51
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
CREAR VECTORES CON ELEMENTOS EQUITATIVAMENTE ESPACIADOS

52
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
UNIÓN (COMPOSICIÓN) DE VECTORES

53
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
MULTIPLICACIÓN Y DIVISIÓN DE VECTORES ELEMENTO A ELEMENTO

54
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
MULTIPLICACIÓN Y DIVISIÓN DE VECTORES ELEMENTO A ELEMENTO

55
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
APLICAR FUNCIONES MATEMÁTICAS A ELEMENTOS DE UN VECTOR

56
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
APLICAR FUNCIONES MATEMÁTICAS A ELEMENTOS DE UN VECTOR

57
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
CREAR VECTORES DE ELEMENTOS ALEATORIOS

58
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
CREAR VECTORES DE ELEMENTOS ALEATORIOS

59
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
CÁLCULO DE LA MEDIA, MEDIANA, Y DESVIACIÓN ESTANDAR DE DATOS EN UN VECTOR

60
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
TRABAJAR CON VECTORES Y LA CAJA DE HERRAMIENTAS SIMBÓLICAS

61
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
TRABAJAR CON VECTORES Y LA CAJA DE HERRAMIENTAS SIMBÓLICAS

62
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 6: VECTORES
TRABAJAR CON VECTORES Y LA CAJA DE HERRAMIENTAS SIMBÓLICAS

63
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
CREAR MATRICES, INGRESAR Y EXTRAER ELEMENTOS

64
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
CREAR MATRICES, INGRESAR Y EXTRAER ELEMENTOS

65
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
CREAR MATRICES, INGRESAR Y EXTRAER ELEMENTOS

66
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
SUMA Y RESTA DE MATRICES, Y MULTIPLICACIÓN POR UN ESCALAR

67
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
SUMA Y RESTA DE MATRICES, Y MULTIPLICACIÓN POR UN ESCALAR

68
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
MULTIPLICACIÓN DE MATRICES

69
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
MULTIPLICACIÓN Y DIVISIÓN DE MATRICES ELEMENTO A ELEMENTO

70
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
LONGITUD, TAMAÑO, Y SUMA Y NÚMERO DE ELEMENTOS EN UNA MATRIZ

71
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
COMPOSICIÓN DE MATRICES

72
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
APLICACIÓN DE FUNCIONES MATEMÁTICAS A MATRICES

73
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
APLICACIÓN DE FUNCIONES MATEMÁTICAS A MATRICES

74
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
MATRIZ IDENTIDAD

75
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
MATRIZ TRASPUESTA, ELEMENTOS DIAGONALES Y DESCOMPOSICIÓN SUPERIOR Y INFERIOR

76
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
RESOLVER SISTEMAS DE ECUACIONES USANDO LA FORMA ECHELON DE FILA REDUCIDA (RREF)

77
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
DETERMINANTE, INVERSA, RANGO Y TRAZA DE MATRICES

78
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
DETERMINANTE, INVERSA, RANGO Y TRAZA DE MATRICES

79
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
NORMA DE MATRIZ , VALORES EIGEN Y EL POLINOMIO CARACTERISTICO

80
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
MATRICES Y LAS HERRAMIENTAS SIMBÓLICAS

81
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
MATRICES Y LAS HERRAMIENTAS SIMBÓLICAS

82
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
MATRICES Y LAS HERRAMIENTAS SIMBÓLICAS

83
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 7: MATRICES
MATRICES Y LAS HERRAMIENTAS SIMBÓLICAS

84
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 8: CÁLCULOS ALGEBRAICOS
RESOLUCIÓN DE ECUACIONES ALGEBRAICAS

85
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 8: CÁLCULOS ALGEBRAICOS
RESOLUCIÓN DE ECUACIONES ALGEBRAICAS

86
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 8: CÁLCULOS ALGEBRAICOS
RESOLUCIÓN DE SISTEMAS DE ECUACIONES LINEALES

87
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 8: CÁLCULOS ALGEBRAICOS
RESOLUCIÓN DE ECUACIONES ALGEBRAICAS SIMBÓLICAMENTE

88
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 8: CÁLCULOS ALGEBRAICOS
RESOLUCIÓN DE SISTEMAS DE ECUACIONES ALGEBRAICAS SIMBÓLICAMENTE

89
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 8: CÁLCULOS ALGEBRAICOS
RESOLUCIÓN DE SISTEMAS DE ECUACIONES ALGEBRAICAS SIMBÓLICAMENTE

90
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 8: CÁLCULOS ALGEBRAICOS
DEFINICIÓN DE FUNCIONES MATEMÁTICAS

91
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 8: CÁLCULOS ALGEBRAICOS
DEFINICIÓN DE FUNCIONES MATEMÁTICAS

92
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 9: CÁLCULO DIFERENCIAL E INTEGRAL
DERIVADAS DE FUNCIONES

93
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 9: CÁLCULO DIFERENCIAL E INTEGRAL
EVALUACIÓN DE DERIVADAS DE FUNCIONES EN UN PUNTO

94
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 9: CÁLCULO DIFERENCIAL E INTEGRAL
DERIVADAS PARCIALES

95
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 9: CÁLCULO DIFERENCIAL E INTEGRAL
INTEGRALES DEFINIDAS E INDEFINIDAS

96
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 9: CÁLCULO DIFERENCIAL E INTEGRAL
LÍMITES

97
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 10: GRÁFICOS
GRÁFICOS

Diagrama de dispersión Diagrama de dispersión


4 4 4

3.5 3.5 3.5

3 3 3

2.5 2.5 2.5

Eje y
2 2 2

1.5 1.5 1.5

1 1 1

0.5 0.5 0.5

0 0 0
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
Eje x

98
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 10: GRÁFICOS
GRÁFICOS

99
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 10: GRÁFICOS
GRÁFICOS

100
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 10: GRÁFICOS
MÚLTIPLES GRÁFICOS Y FORMATO

1 1 1

0.8 0.8 0.8

0.6 0.6 0.6

0.4 0.4 0.4

0.2 0.2 0.2

0 0 0

-0.2 -0.2 -0.2

-0.4 -0.4 -0.4

-0.6 -0.6 -0.6

-0.8 -0.8 -0.8

-1 -1 -1
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

101
Docente: Ing. Danilo Noguera 06/05/2017
TEMA 10: GRÁFICOS
MÚLTIPLES GRÁFICOS Y FORMATO

1 1
Seno(x)
0.8 0.8 Cos(x)

0.6 0.6

0.4 0.4

0.2 0.2

0 0

-0.2 -0.2

-0.4 -0.4

-0.6 -0.6

-0.8 -0.8

-1 -1
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

102
Docente: Ing. Danilo Noguera 06/05/2017

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