TEMA 5 ASIE

download TEMA 5 ASIE

of 5

Transcript of TEMA 5 ASIE

  • 8/9/2019 TEMA 5 ASIE

    1/8

    Regula trapezului(lansarea unei rachete)

    Miclaus Alexandru:322/2

    Problema propusă:

    O rachetă decolează pe vertical şi elimină combustibil cu o viteză de 2000

    m/s cu un consum de combustibil de 200 !"/s# $ni%ial masa rachetei este de&0'000 !"# (acă racheta porneşte de la 0=t   sec#' cum putem calcula

    distan%a parcursă de rachetă )n perioada de la *=t   p+nă la 30=t   sec#,

    Rezolvare: 

    (aca=

    0m  masa initiala a rachetei la momentul 0=t   -!".

    =q  debitul cu care este expulzat combustibilul -!"/sec.

    =u  viteza cu care este expulzat combustibilul -m/s.(eoarece combustibilul este expulzat din racheta' masa rachetei va scadea in

    timp' si devine la un moment dat de timp t:qt mm   −=   0

    ortele exercitate asupra rachetei in orice moment rezulta din aplicarea le"ii

    a doua a miscarii' a lui e1tonaqt m g qt muqmamg uqma F    .-.- 00   −=−−⇒=−⇒=∑

    nde = g   acceleratia "ravitationala -m/s2.

    C  gt qt mudt 

    dx g 

    qt m

    uq

    dt 

     xd  g 

    qt m

    uqa

    e   +−−−=⇒−−

    =⇒−−

    =   .-lo" 00

    2

    2

    0

    Pornind de la aptul ca racheta pleaca de pe suport

    .-lo".-lo"000 00   muC C mudt 

    dx

    t  La ee   =⇒+=⇒=⇒=

    (eci:

     gt qt m

    mu

    dt 

    dxmu gt qt mu

    dt 

    dxee   −  

     

      

     −

    =⇔+−−−=0

    0

    e00 lo".-lo".-lo"

    4ezulta ca distanta parcursa de racheta de la 0t t   =  la t t   =  este'

  • 8/9/2019 TEMA 5 ASIE

    2/8

    Regula trapezului(lansarea unei rachete)

    Miclaus Alexandru:322/2

    ∫   

    −  

     

      

     −

    =

    0i

    i

    m

    mln

    dt  gt qt 

    u x

    $nlocuind cu datele precizate' se obtine:

    In continuare rezolvam in MATLAB problema:

    *programul in matlab este urmatorul:

    clc

    clf

    clear all

    % Purpose

    % To illustrate the trapezoidal method as applied to a function

    % of the user's choosing.

     

    % Keyword

    % Trapezoidal Method% Numerical Integration

     

    % Inputs

    % This is the only place in the program where the user makes the

    changes

    % ased on their wishes

     

    % f!"#$ the function to integrate

     

    f &!"# ()))*log!+,))))-+,)))).-(+))*"#./*" 0

     

    % a$ the lower limit of integration

     

    a/ 0

     

    % $ the upper limit of integration

     

    1) 0

     

    % n$ the ma"imum numer of segments

     

  • 8/9/2019 TEMA 5 ASIE

    3/8

    Regula trapezului(lansarea unei rachete)

    Miclaus Alexandru:322/2  n2) 0

     

    %**********************************************************************

     

    % This displays title information

    disp!sprintf!'3n3n4imulation of the Trapezoidal Method'##

    disp!sprintf!'5ni6ersity of 4outh 7lorida'##

    disp!sprintf!'5nited 4tates of 8merica'##

    disp!sprintf!'kaw&eng.usf.edu3n'##

     

    disp!sprintf!'3n*******************************Introduction*************

    ********************'##

     

    % 9isplays introduction te"t

    disp!'Trapezoidal rule is ased on the Newton:otes formula that if one

    appro"imates the'#

    disp!'integrand y an nth order polynomial$ then the integral of the

    function is appro"imated'#

    disp!'y the integral of that nth order polynomial. Integrating

    polynomials is simple and is'#

    disp!'ased on calculus. Trapezoidal rule is the area under the cur6efor a first order'#

    disp!'polynomial !straight line#.'#

     

    % 9isplays what inputs are eing used

    disp!sprintf!'3n3n********************************Input

    9ata**********************************3n'##

    disp!sprintf!' f!"#$ integrand function'##

    disp!sprintf!' a %g$ lower limit of integration '$a##

    disp!sprintf!' %g$ upper limit of integration '$##

    disp!sprintf!' n %g$ numer of sudi6isions'$n##

    format short g

     

    % :alculate the spacing parameter

    disp!sprintf!'3n7or this simulation$ the following parameter is

    constant.3n'##

    h!a#-n 0

    disp!sprintf!' h ! a # - n '##

    disp!sprintf!' ! %g %g # - %g '$$a$n##

    disp!sprintf!' %g'$h##

     

    % This egins the simulation of the method

    disp!sprintf!'3n*******************************4imulation***************

    ******************3n'##

    sum) 0

    disp!'The appro"imation is e"pressed as'#

    disp!' '#

    disp!' appro" h * ! ).2*f!a# ; 4um !i+$n+# f!a;i*h# ;).2*f!# #'#

    disp!' '#

     

    % 4um all function 6alues not including e6alations at a and

    disp!'+#

  • 8/9/2019 TEMA 5 ASIE

    4/8

    Regula trapezului(lansarea unei rachete)

    Miclaus Alexandru:322/2disp!' 4um !i+$n+# f!a;i*h#'#

    disp!' '#

    for i+=n(

      disp!sprintf!' f!%g#'$a;i*h##

    end

    disp!sprintf!' ; f!%g#'$a;!n+#*h##

    disp!sprintf!' '##

    for i+=n(

      sumsum;f!a;i*h# 0

      disp!sprintf!' %g'$f!a;i*h###

    end

    sumsum;f!a;!n+#*h# 0

    disp!sprintf!' ; %g'$f!a;!n+#*h###

    disp!sprintf!' '##

    disp!sprintf!' %g3n'$sum##

     

    % Now add half the end point e6aluations

    disp!'(# 8dd to this ).2*!f!a# ; f!##'#

    disp!' '#

    disp!sprintf!' %g ; ).2*!%g ; %g# '$sum$f!a#$f!###

    disp!sprintf!' %g ; %g %g'$sum$).2*!f!a#;f!##$sum;).2*!f!a#;f!####

    sumsum;).2*!f!a#;f!## 0

    disp!' '#

     

    % 8nd finally multiply y h

    disp!'1# Multiply this y h to get the appro"imation for the integral.'#

    disp!' '#

    disp!sprintf!' appro" h * %g'$sum##

    disp!sprintf!' appro" %g * %g'$h$sum##

    appro"h*sum 0

    disp!sprintf!' appro" %g'$appro"##

     

    % The following displays results

    disp!sprintf!'3n3n**************************>esults*********************

    *******'##

     

    % The following finds what is called the '?"act' solution

    e"act @uad!f$a$# 0

    disp!sprintf!'3n 8ppro"imate %g'$appro"##

    disp!sprintf!' ?"act %g'$e"act##

    disp!sprintf!'3n True ?rror ?"act 8ppro"imate'##

    disp!sprintf!' %g %g'$e"act$appro"##

    disp!sprintf!' %g'$e"actappro"##

    disp!sprintf!'3n 8solute >elati6e True ?rror Percentage'##

    disp!sprintf!' A ! ?"act 8ppro"imate # - ?"act A *

    +))'##disp!sprintf!' A %g - %g A * +))'$e"actappro"$e"act##

    disp!sprintf!' %g'$as! !e"actappro"#-e"act #*+))##

     

    disp!sprintf!'3nThe trapezoidal appro"imation can e more accurate if we

    made our'##

    disp!sprintf!'segment size smaller !that is$ increasing the numer of

    segments#.3n3n'##

     

  • 8/9/2019 TEMA 5 ASIE

    5/8

    Regula trapezului(lansarea unei rachete)

    Miclaus Alexandru:322/2% The following code is needed to produce the trapezoidal method

    % 6isualization.

    "!+#a 0

    y!+#f!a# 0

    hold on

    for i+=n

      "!i;+#a;i*h 0

      y!i;+#f!"!i;+## 0

      fill!B"!i# "!i# "!i;+# "!i;+#C$ B) y!i# y!i;+# )C$ 'y'#

    end

    "rangea=!a#-+)))=0

    plot!"range$f!"range#$'k'$'Dinewidth'$(#

    title!'Integrand function and Eraphical 9epiction of Trapezoidal

    Method'#

    5r  ezultatele problemei sunt:55555555555555555555$nput (ata5555555555555555555555555

      -x.' inte"rand unction  a 6 *' lo1er limit o inte"ration

     b 6 30' upper limit o inte"rationn 6 70' number o subdivisions

    or this simulation' the ollo1in" parameter is constant#

      h 6 - b 8 a . / n

    6 - 30 8 * . / 706 0#&&

    555555555555555555559imulation5555555555555555555555555

    he approximation is expressed as 

  • 8/9/2019 TEMA 5 ASIE

    6/8

    Regula trapezului(lansarea unei rachete)

    Miclaus Alexandru:322/2

      approx 6 h 5 - 0#75-a. ; 9um -i6'n8. -a;i5h. ; 0#75-b. .

     .

  • 8/9/2019 TEMA 5 ASIE

    7/8

    Regula trapezului(lansarea unei rachete)

    Miclaus Alexandru:322/2

      rue rror 6 xact 8 Approximate

      6 207>*? 8 207>?2  6 82#?7=3*

      Absolute 4elative rue rror Percenta"e  6 B - xact 8 Approximate . / xact B 5 00  6 B 82#?7=3* / 207>*? B 5 00  6 0#00&3==?

    *se obtine graficul urmator:

    Concluzie:

  • 8/9/2019 TEMA 5 ASIE

    8/8