Sei sulla pagina 1di 5

Anlisis numrico I

Unidad 1.Fundamentos
Actividad 2. Modelacin matemtica
Como describimos en la seccin de Modelacin Matemtica el hacer un modelo implica
observar un fenmeno y traducirlo a lenguaje matemtico. Esta traduccin no es sencilla
de automatizar, es decir, puede ser muy personal y variar de persona a persona pero en
esa seccin leste un bosquejo de como hacerlo. A continuacin implementaremos en
Octave como se modela el tiro parablico.

La ecuacin que describe el tiro parablico desde el origen es:


( )
donde

es la velocidad inicial del cuerpo proyectado.

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)
Conretamente una funcin de dos parmetros
AL12504399
AARON CAMPUZANO DE LA TORRE

se define como

Anlisis numrico I
Unidad 1.Fundamentos
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
dos vectores de manera implcita de la siguiente forma. Supongamos que X e Y son
vecotres,
>>> Z = X*.Y
El operador punto (.) le indica a Octave que tiene que multiplicar el elemento i-simo de X
por el elemento i-simo de Y y construir al mismo tiempo el vector Z de tal forma que
Z(i) = X(i) * Y(i)
Si tenemos la funcin funcM que es una funcin que recibe un solo parmetro y regresa
un escalar, entonces podemos aplicarla a todo el vector X de la siguiente forma
Z = funcM(X)

SOLUCIN:
Lo primero que procedo a hacer es editar los parmetros de la funcin de la siguiente
manera sin linspace:

function y=parabolico(v);
g=9.8;
x= 10;
y=v*x+((1/2)*-g*x.^2);
endfunction
Despus procedo a verificar cada uno de los datos proporcionados:
>>> v=10;
>>> g=9.8;
>>> t=(0);
>>> h=v*t+((1/2)*-g*t^2);
>>> h=v*t+((1/2)*-g*t^2)
h=0
>>> v=10;
>>> g=9.8;
>>> t=(10);
>>> h=v*t+((1/2)*-g*t^2)
h = -390.00
>>> 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)

AL12504399
AARON CAMPUZANO DE LA TORRE

Anlisis numrico I
Unidad 1.Fundamentos
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

ya despus procedo a realizarlo 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(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:
-66.70340 -70.54280 -74.48220 -78.52158 -82.66095 -86.90032
Columns 55 through 60:
-91.23967 -95.67901 -100.21835 -104.85767 -109.59698 -114.43628
Columns 61 through 66:
-119.37557 -124.41486 -129.55413 -134.79339 -140.13264 -145.57188
Columns 67 through 72:
-151.11111 -156.75033 -162.48954 -168.32874 -174.26793 -180.30711
Columns 73 through 78:
-186.44628 -192.68544 -199.02459 -205.46373 -212.00286 -218.64198
Columns 79 through 84:
-225.38108 -232.22018 -239.15927 -246.19835 -253.33741 -260.57647
Columns 85 through 90:
-267.91552 -275.35456 -282.89358 -290.53260 -298.27160 -306.11060
Columns 91 through 96:
-314.04959 -322.08856 -330.22753 -338.46648 -346.80543 -355.24436
Columns 97 through 100:
-363.78329 -372.42220 -381.16111 -390.00000

AL12504399
AARON CAMPUZANO DE LA TORRE

Anlisis numrico I
Unidad 1.Fundamentos
>>> 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
Columns 79 through 84:
-304.16896 -312.01816 -319.96735 -328.01653 -336.16570 -344.41486
Columns 85 through 90:
-352.76400 -361.21314 -369.76227 -378.41139 -387.16049 -396.00959
Columns 91 through 96:
-404.95868 -414.00775 -423.15682 -432.40588 -441.75492 -451.20396
Columns 97 through 100:
-460.75298 -470.40200 -480.15100 -490.00000
>>> 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
Columns 25 through 30:
213.62718 221.27844 228.82971 236.28099 243.63228 250.88358
Columns 31 through 36:
258.03489 265.08622 272.03755 278.88889 285.64024 292.29160
Columns 37 through 42:
298.84298 305.29436 311.64575 317.89715 324.04857 330.09999
Columns 43 through 48:
336.05142 341.90287 347.65432 353.30579 358.85726 364.30874
Columns 49 through 54:
369.66024 374.91174 380.06326 385.11478 390.06632 394.91787
Columns 55 through 60:
399.66942 404.32099 408.87256 413.32415 417.67575 421.92735
Columns 61 through 66:
426.07897 430.13060 434.08224 437.93388 441.68554 445.33721
Columns 67 through 72:

AL12504399
AARON CAMPUZANO DE LA TORRE

Anlisis numrico I
Unidad 1.Fundamentos
448.88889 452.34058 455.69228 458.94399 462.09570 465.14743
Columns 73 through 78:
468.09917 470.95092 473.70268 476.35445 478.90623 481.35802
Columns 79 through 84:
483.70983 485.96164 488.11346 490.16529 492.11713 493.96898
Columns 85 through 90:
495.72084 497.37272 498.92460 500.37649 501.72840 502.98031
Columns 91 through 96:
504.13223 505.18416 506.13611 506.98806 507.74003 508.39200
Columns 97 through 100:
508.94399 509.39598 509.74798 510.0000

AL12504399
AARON CAMPUZANO DE LA TORRE

Potrebbero piacerti anche