1 / 56

Octave Lab

Profesor Hermann Pempelfort Vergara. Octave Lab. 2 + 3. ans = 5. ans + ans. ans = 10. A = 7. B = 8. B * A. ans = 56. C = [1 2]. D = [3;4]. ans = 11. E = [1 2;3 4]. F = [4 3;2 1]. F - E. ans = [3 1;-1 -3]. F / A. ans = [0.57 0.42;0.28 0.14]. G = inv (E).

Download Presentation

Octave Lab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Profesor Hermann Pempelfort Vergara OctaveLab

  2. 2 + 3

  3. ans = 5

  4. ans + ans

  5. ans = 10

  6. A = 7

  7. B = 8

  8. B * A

  9. ans = 56

  10. C = [1 2]

  11. D = [3;4]

  12. ans = 11

  13. E = [1 2;3 4]

  14. F = [4 3;2 1]

  15. F - E

  16. ans = [3 1;-1 -3]

  17. F / A

  18. ans = [0.57 0.42;0.28 0.14]

  19. G = inv(E)

  20. ans = [-2 1;1.5 -0.5]

  21. G * E

  22. ans = [1 0;0 1]

  23. T = [2 0 2;4 2 4;8 4 8]

  24. T’

  25. ans = [2 4 8;0 2 4;2 4 8]

  26. T * T’

  27. ans = [8 16 32;16 36 72;32 72 144]

  28. Z = ans

  29. Y = [1 2 3;4 5 6;7 8 9]

  30. plot (Z,Y)

  31. Plot (Y,Z)

  32. L = log(Z)

  33. Plot(L,Z)

  34. Hacer funciones. • @(x,y,z) x .* y .^z • @: Indica el inicio de una función. • ( ): Contienen la cantidad de variables. • x,y,z: Son las variables que se ocuparan. • “En función de”. • . : Es necesario para utilizar un símbolo • aritmético con variables. • x .* y .^z: Ecuación equivalente a: • X por Y éste elevado a Z.

  35. x = @(a,b) cos(a) .* sin(b)

  36. Linspace • Líneas de espacios. • Permiten evaluar una función en rangos. • Quiero evaluar X desde 0 hasta 20, o sea, • 0 <= X <= 20. • Hago: linspace(0,20,21) • Donde 0 es el inicio, • 20 el término y • 21 la cantidad de intervalos. • O Hago: linspace(0,20) • Donde 0 es el inicio y • 20 el término, pero • Considerando que la cantidad de intervalos es 100.

  37. a = linspace(0,2*pi)

  38. b = linspace(0,pi)

  39. X = x(a,b)

  40. plot(X.^2)

  41. Otras funciones básicas • logspace (base, limite, N) • Es similar a linspace, solo que está espaciada logarítmicamente entre 10Base y 10Limite • dot (u, v, dim) • Producto escalar de dos vectores (u,v), expresado en dim dimensiones.

  42. Otras funciones • sum ( x , dim ) • Suma los valores del vector en dim dimensiones. • prod (x , dim ) • Multiplica los valores del vector en dim dimensiones. • clearall • Elimina todas las variables creadas.

  43. clearall

  44. A = [10 5 0;5 10 5;0 5 10]

  45. sum(A)

  46. ans = [15 20 15]

  47. prod(A)

  48. ans = [0 250 0]

  49. prod(A)’*sum(A)

More Related