Saltar al contenido principal
LibreTexts Español

8.4: Modo interactivo

  • Page ID
    82314
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    En el modo de comando, MATLAB muestra un prompt (\(\gg\)) y espera su entrada. Puede escribir cualquier expresión matemática legal para su evaluación inmediata. Pruebe los siguientes tres ejemplos (presione “enter” o “return” al final de cada línea):

    ≫ 2+2
    ≫ 5^2
    ≫ 2*sin(pi/4)

    La variable pi = 3.14 está integrada en MATLAB, al igual que la función sin y cientos de otras funciones. Cuando ingresó cada una de las líneas anteriores, MATLAB almacenó los resultados en una variable llamada ans for answer. Luego se mostró el valor de ans. La última línea debió haber producido la raíz cuadrada de 2. Podemos manipular ans para averiguarlo

    ≫ ans^2

    La nueva respuesta está muy cerca de 2, como se esperaba. Veamos cuál es el error de redondeos:

    ≫ ans-2

    This page titled 8.4: Modo interactivo is shared under a CC BY 3.0 license and was authored, remixed, and/or curated by Louis Scharf (OpenStax CNX) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.