Академический Документы
Профессиональный Документы
Культура Документы
UnADMxico
Licenciatura en Matemticas
Anlisis Numrico 1
Actividad 2: Modelacin Matemtica
Alumno: Gregorio Islas Oliver
Profesor(a): Alejandro Salazar Guerrero
Tizayuca Hidalgo a 12 de Octubre del 2014
La tarea es crear una funcin en Octave que recibe dos parmetros y regresa un escalar
que representar la altura del proyectil en cada tiempo . Debers mostrar la trayectoria
( ) seguida para las siguientes valores de y vectores
V
10
25
100
Vectores de T
(0,10,100)
(0,20,250)
(0,50,300)
Para definir la serie de valores donde aplicars tu funcin, es decir, todos los valores
tienes que hacer uso de la funcin linspace de la siguiente manera
>>> t = linspace(0,10,100)
Que quiere decir que es un vector con valores reales entre 0 y 10 con 100 puntos
distribuidos equidistantemente
Recuerda por cada funcin debes crear un archivo que se llame igual que la funcin pero
con extensin .m y en una carpeta de tu eleccin.
Tip: Para definir una funcin, llamada funcX, de n parmetros en Octave la sintaxis es la
siguiente
function y = funcX(n1,n2,,nk)
Concretamente una funcin de dos parmetros
se define como
function y = funcX(x,y)
Tip 2: Octave permite el uso de operaciones puntuales, es decir, extiende la aplicacin de
la suma, producto y divisin (entre otras) a vectores, lo que significa que puedes sumar
>>> v=25;
>>> t=(0);
>>> g=9.8;
>>> h=v*t+((1/2)*-g*t^2)
h=0
>>> v=25; >>> t=(20);
>>> g=9.8; >>>
h=v*t+((1/2)*-g*t^2)
h = -1460.0
>>> v=100;
>>> t=(0);
>>> g=9.8;
>>> h=v*t+((1/2)*-g*t^2)
h=0
>>> v=100;
>>> t=(50);
>>> g=9.8;
>>> h=v*t+((1/2)*-g*t^2)
h = -7250
>>> y=parabolico(10)
y = -390.00
y = -390.00
Con linspace function
y=parabolico(v);%Velocidad del cuerpo proyectado
g=9.8;%Aceleracin gravitacional
x=linspace(0,10,100);%tiempo
y=v*x+((1/2)*-g*x.^2);%frmula
endfunction
>>> y=parabolico(0)
y=
Columns 1 through 6:
0.00000 -0.04999 -0.19998 -0.44995 -0.79992 -1.24987
Columns 7 through 12:
-1.79982 -2.44975 -3.19967 -4.04959 -4.99949 -6.04938
Columns 13 through 18:
-7.19927 -8.44914 -9.79900 -11.24885 -12.79869 -14.44853
Columns 19 through 24:
-16.19835 -18.04816 -19.99796 -22.04775 -24.19753 -26.44730
Columns 25 through 30:
-28.79706 -31.24681 -33.79655 -36.44628 -39.19600 -42.04571
Columns 31 through 36:
-44.99541 -48.04510 -51.19478 -54.44444 -57.79410 -61.24375
Columns 37 through 42:
-64.79339 -68.44302 -72.19263 -76.04224 -79.99184 -84.04142
Columns 43 through 48:
-88.19100 -92.44057 -96.79012 -101.23967 -105.78921 -110.43873
Columns 49 through 54:
-115.18825 -120.03775 -124.98725 -130.03673 -135.18621 -140.43567
Columns 55 through 60:
-145.78512 -151.23457 -156.78400 -162.43343 -168.18284 -174.03224
Columns 61 through 66:
-179.98163 -186.03102 -192.18039 -198.42975 -204.77910 -211.22845
Columns 67 through 72:
-217.77778 -224.42710 -231.17641 -238.02571 -244.97500 -252.02428
Columns 73 through 78:
-259.17355 -266.42281 -273.77206 -281.22130 -288.77053 -296.41975
>>> y=parabolico(10)
y=
Columns 1 through 6:
0.00000 0.96011 1.82022 2.58035 3.24049 3.80063
Columns 7 through 12:
4.26079 4.62096 4.88113 5.04132 5.10152 5.06173
Columns 13 through 18:
4.92195 4.68218 4.34241 3.90266 3.36292 2.72319
Columns 19 through 24:
1.98347 1.14376 0.20406 -0.83563 -1.97531 -3.21498
Columns 25 through 30:
-4.55464 -5.99429 -7.53393 -9.17355 -10.91317 -12.75278
Columns 31 through 36:
-14.69238 -16.73197 -18.87154 -21.11111 -23.45067 -25.89022
Columns 37 through 42:
-28.42975 -31.06928 -33.80880 -36.64830 -39.58780 -42.62728
Columns 43 through 48:
-45.76676 -49.00622 -52.34568 -55.78512 -59.32456 -62.96398
Columns 49 through 54:
>>> y=parabolico(100)
y=
Columns 1 through 6:
0.00000 10.05102 20.00204 29.85308 39.60412 49.25518
Columns 7 through 12:
58.80624 68.25732 77.60841 86.85950 96.01061 105.06173
Columns 13 through 18:
114.01286 122.86399 131.61514 140.26630 148.81747 157.26865
Columns 19 through 24:
165.61983 173.87103 182.02224 190.07346 198.02469 205.87593