Download - APLICACIONES COMPUTACIONALES...cv = cos(vv) % Función coseno tv = tan(vv) % Función tangente %% Operaciones aritméticas ww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww) 2013

Transcript
Page 1: APLICACIONES COMPUTACIONALES...cv = cos(vv) % Función coseno tv = tan(vv) % Función tangente %% Operaciones aritméticas ww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww) 2013

APLICACIONES COMPUTACIONALES INGENIERÍA EJECUCIÓN MECÁNICA

INTRODUCCIÓN A MATLAB

2013 | [email protected] | APLICACIONES COMPUTACIONALES | IEM

Page 2: APLICACIONES COMPUTACIONALES...cv = cos(vv) % Función coseno tv = tan(vv) % Función tangente %% Operaciones aritméticas ww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww) 2013

INTRODUCCIÓN A MATLAB INTERFAZ DE USUARIO (GUI)

2013 | [email protected] | APLICACIONES COMPUTACIONALES | IEM

Page 3: APLICACIONES COMPUTACIONALES...cv = cos(vv) % Función coseno tv = tan(vv) % Función tangente %% Operaciones aritméticas ww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww) 2013

INTRODUCCIÓN A MATLAB INSTRUCCIONES BÁSICAS %% Matrices y Vectores% Definir una matrizA = [1, -2, 5 ; 0, 3, -1; 7, 4, -9] % Definir un vectorb = [1; 2; 3] % Multiplicación de matricesB = A * AC = A * BD = C’ * A % C’ = transpose(C)

2013 | [email protected] | APLICACIONES COMPUTACIONALES | IEM

Page 4: APLICACIONES COMPUTACIONALES...cv = cos(vv) % Función coseno tv = tan(vv) % Función tangente %% Operaciones aritméticas ww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww) 2013

INTRODUCCIÓN A MATLAB INSTRUCCIONES BÁSICAS % Multiplicación de vectores: c = b * b' % Se obtiene una matrizd = b' * b % Se obtiene un escalard = dot(b,b) % Se obtiene un escalar % Multiplicación de matrices y vectores:f = A * b % Se obtiene un vectorg = b * A % Dimensiones incorrectas% Dimensión de una matriz o vector:da = size(A)db = size(b)

2013 | [email protected] | APLICACIONES COMPUTACIONALES | IEM

Page 5: APLICACIONES COMPUTACIONALES...cv = cos(vv) % Función coseno tv = tan(vv) % Función tangente %% Operaciones aritméticas ww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww) 2013

INTRODUCCIÓN A MATLAB INSTRUCCIONES BÁSICAS %% Operaciones sobre una matrizA = rand(4,4) % Función randomda = det(A) % Determinanten2 = norm(A,2) % Norma 2n2 = sqrt(max(eigs(A'*A))) % Norma 2ta = trace(A) % Trazata = sum(diag(A)) % Traza%% Operaciones sobre un vectorb = ones(5,1) % Función “unos”nb = norm(b) % Norma euclídea

2013 | [email protected] | APLICACIONES COMPUTACIONALES | IEM

Page 6: APLICACIONES COMPUTACIONALES...cv = cos(vv) % Función coseno tv = tan(vv) % Función tangente %% Operaciones aritméticas ww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww) 2013

INTRODUCCIÓN A MATLAB INSTRUCCIONES BÁSICAS %% Operaciones trigonométricasvv = (0:pi/30:pi) % Vector filasv = sin(vv) % Función senocv = cos(vv) % Función cosenotv = tan(vv) % Función tangente%% Operaciones aritméticasww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww)

2013 | [email protected] | APLICACIONES COMPUTACIONALES | IEM

Page 7: APLICACIONES COMPUTACIONALES...cv = cos(vv) % Función coseno tv = tan(vv) % Función tangente %% Operaciones aritméticas ww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww) 2013

INTRODUCCIÓN A MATLAB INSTRUCCIONES BÁSICAS %% Gráficos 2Dxx = (pi/30:pi/30:pi) yy = sin(xx) + log(xx) plot(xx, yy)plot(xx, yy, 'LineWidth',2)plot(xx, yy, 'r','LineWidth',2)plot(xx, yy, '--r','LineWidth',2)plot(xx, yy, '--rs','LineWidth',2)

2013 | [email protected] | APLICACIONES COMPUTACIONALES | IEM

Page 8: APLICACIONES COMPUTACIONALES...cv = cos(vv) % Función coseno tv = tan(vv) % Función tangente %% Operaciones aritméticas ww = vv + 2 * vv ww = sin(ww) + cos(vv) + tan(vv + ww) 2013

INTRODUCCIÓN A MATLAB INSTRUCCIONES BÁSICAS %% Gráficos 2D

2013 | [email protected] | APLICACIONES COMPUTACIONALES | IEM