resolución problemas libro moore

13
RESOLUCIÓN PROBLEMAS LIBRO MOORE pag 221 Problema 1. a) La función para el problema quedaría: function result=num_grains(n) %Esta función calcula número de granos en una area de una pulgada cuadrada %a 100x de un cristal. N=2^(n-1); result=N; ejecutando en la ventana de comandos: >> num_grains(2) ans = 2 >> num_grains(4) ans = 8 >> num_grains(11) ans = 1024 b) Para encontrar de n=10 hasta n=100, hacemos un script que sería: N=[]; for n=10:1:100 N=[N num_grains(n)]; end N plot([10:1:100],N) grid on; y nos arroja los resultados:

Upload: daniel-leon

Post on 11-Sep-2015

236 views

Category:

Documents


0 download

DESCRIPTION

METODOS NUMERICOS

TRANSCRIPT

  • RESOLUCIN PROBLEMAS LIBRO MOORE pag 221

    Problema 1.

    a) La funcin para el problema quedara:

    function result=num_grains(n)

    %Esta funcin calcula nmero de granos en una area de una pulgada

    cuadrada

    %a 100x de un cristal.

    N=2^(n-1);

    result=N;

    ejecutando en la ventana de comandos:

    >> num_grains(2)

    ans =

    2

    >> num_grains(4)

    ans =

    8

    >> num_grains(11)

    ans =

    1024

    b) Para encontrar de n=10 hasta n=100, hacemos un script que sera: N=[]; for n=10:1:100 N=[N num_grains(n)]; end

    N plot([10:1:100],N) grid on;

    y nos arroja los resultados:

  • N = 1.0e+029 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 19 through 27 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 28 through 36 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 37 through 45 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 46 through 54 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 55 through 63 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 64 through 72 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 73 through 81 0.0000 0.0000 0.0001 0.0002 0.0004 0.0008 0.0015 0.0031 0.0062 Columns 82 through 90 0.0124 0.0248 0.0495 0.0990 0.1981 0.3961 0.7923 1.5846 3.1691 Column 91 6.3383

    Y la grfica:

  • X=11, Y=1024 , nos indica que los resultados con correctos.

    Problema2.

    a) La funcin energy:

    function result=energy(m) E=m.*(2.9979*10^8)^2; E=doubl(E);

    result=E;

    evaluando en la ventana de comandos:

    >> energy(0.20)

    ans =

    1.7975e+016

    >> energy(0.11)

    ans =

    9.8861e+015

  • b) Graficando

    >> m=[0 10 100 1000 10000 100000 1000000];

    >> E=energy(m);

    >> plot(m,E);xlabel('Masa');ylabel('Energia')

    >> grid on

    Problema 3.

    a) La funcin quedara: function result=nmoles(x,y)

    n=x./y;

    result=n;

    b) Segn los datos, y para efecto de la divisin miembro a miembro definimos para las

    masas(1g hasta 10g) y las masas molares de los elementos(Benceno, Alcohol,

    tetrafluoreaetano):

    >> m=meshgrid([1:1:10],[1:1:3])

    m =

    1 2 3 4 5 6 7 8 9 10

  • 1 2 3 4 5 6 7 8 9 10

    1 2 3 4 5 6 7 8 9 10

    >> m=m'

    m =

    1 1 1

    2 2 2

    3 3 3

    4 4 4

    5 5 5

    6 6 6

    7 7 7

    8 8 8

    9 9 9

    10 10 10

    >> mw=meshgrid([78.115 46.07 102.3],[1:1:10])

    mw =

    1.0e+002 *

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    >> nmoles(m,mw)

  • ans =

    0.012801638609742 0.021706099413935 0.009775171065494

    0.025603277219484 0.043412198827871 0.019550342130987

    0.038404915829226 0.065118298241806 0.029325513196481

    0.051206554438968 0.086824397655741 0.039100684261975

    0.064008193048710 0.108530497069677 0.048875855327468

    0.076809831658452 0.130236596483612 0.058651026392962

    0.089611470268194 0.151942695897547 0.068426197458456

    0.102413108877936 0.173648795311483 0.078201368523949

    0.115214747487678 0.195354894725418 0.087976539589443

    0.128016386097420 0.217060994139353 0.097751710654936

    Problema 4.

    a) La funcin quedara:

    function result=mass(n,mw) m=n.*mw; result=m;

    b) Poniendo a prueba la funcin para n=1:10, y con los datos de masa molares del

    problema anterior, tenemos.

    >> n=meshgrid([1:1:10],[1:1:3])

    n =

    1 2 3 4 5 6 7 8 9 10

    1 2 3 4 5 6 7 8 9 10

    1 2 3 4 5 6 7 8 9 10

    >> n=n'

    n =

    1 1 1

    2 2 2

  • 3 3 3

    4 4 4

    5 5 5

    6 6 6

    7 7 7

    8 8 8

    9 9 9

    10 10 10

    >> mw=meshgrid([78.115 46.07 102.3],[1:1:10])

    mw =

    1.0e+002 *

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    >> mass(m,mw)

    ans =

    1.0e+003 *

    0.078115000000000 0.046070000000000 0.102300000000000

    0.156230000000000 0.092140000000000 0.204600000000000

    0.234345000000000 0.138210000000000 0.306900000000000

    0.312460000000000 0.184280000000000 0.409200000000000

    0.390575000000000 0.230350000000000 0.511500000000000

    0.468690000000000 0.276420000000000 0.613800000000000

  • 0.546805000000000 0.322490000000000 0.716100000000000

    0.624920000000000 0.368560000000000 0.818400000000000

    0.703035000000000 0.414630000000000 0.920700000000000

    0.781150000000000 0.460700000000000 1.023000000000000

    Problema 6.

    Funcin:

    function result=height(t) h=(-9/8)*(t.^2)+(125*t)+500; result=h;

    Ejecutando:

    >> t=[0:0.5:30];

    >> h=height(t)

    h =

    Columns 1 through 6

    500 562.21875 623.875

    684.96875 745.5 805.46875

    Columns 7 through 12

    864.875 923.71875 982

    1039.71875 1096.875 1153.46875

    Columns 13 through 18

    1209.5 1264.96875 1319.875

    1374.21875 1428 1481.21875

    Columns 19 through 24

    1533.875 1585.96875 1637.5

    1688.46875 1738.875 1788.71875

    Columns 25 through 30

    1838 1886.71875

    1934.875 1982.46875 2029.5

    2075.96875

    Columns 31 through 36

    2121.875 2167.21875 2212

    2256.21875 2299.875 2342.96875

  • Columns 37 through 42

    2385.5 2427.46875 2468.875

    2509.71875 2550 2589.71875

    Columns 43 through 48

    2628.875 2667.46875 2705.5

    2742.96875 2779.875 2816.21875

    Columns 49 through 54

    2852 2887.21875 2921.875

    2955.96875 2989.5 3022.46875

    Columns 55 through 60

    3054.875 3086.71875 3118

    3148.71875 3178.875 3208.46875

    Column 61

    3237.5

    >> plot(h,t)

    >> grid on

    >> xlabel('Alturas')

    >> ylabel('Tiempos')

  • >> %Pero observamos que no hay punto de inflexin o

    concavidad, por lo se deduce an no llega al valor de su

    altura mxima, que es en donde empieza a caer para ello

    aumentamos t

    >> t=[0:0.5:60];

    >> h=height(t);

    >> plot(h,t)

    >> grid on

    >> xlabel('Alturas')

    >> ylabel('Tiempos')

    >> %Observamos la inflexin, por lo tanto

    >> hmax=max(h)

    hmax =

    3972.21875

    >> %luego buscamos el tiempo en que alcanza la altura mxima

    >> t1=find(h==hmax)

    t1 =

    112

  • >> t(112)

    ans =

    55.5

    >> %Por lo tanto alcanza la altura mxima en t=55.5 segundos

    Problema 7.

    Funcin: function [x,velocidad,g]=free_fall(t) x=(1/2)*9.8*(t.^2); velocidad=9.8*t; g=9.8;

    Ejecuntando:

    >> t=[0:20];

    >> [x velocidad g]=free_fall(t)

    x =

    0 4.9 19.6 44.1 78.4

    122.5 176.4 240.1 313.6 396.9

    490 592.9 705.6 828.1 960.4

    1102.5 1254.4 1416.1 1587.6 1768.9

    1960

    velocidad =

    0 9.8 19.6 29.4 39.2

    49 58.8 68.6 78.4 88.2

    98 107.8 117.6 127.4 137.2

    147 156.8 166.6 176.4 186.2

    196

    g =

    9.8

  • Problema 8.

    Funcin :

    function []=polygon(n) %n es el nmero de lados R = 1; theta = [0:(2*pi/n):2*pi]+pi/2; x = R*cos(theta); y = R*sin(theta); plot(x,y); grid on

    ejecutando:

    >> polygon(3)

    >> polygon(5)