EBK NUMERICAL METHODS FOR ENGINEERS
EBK NUMERICAL METHODS FOR ENGINEERS
7th Edition
ISBN: 8220100254147
Author: Chapra
Publisher: MCG
bartleby

Videos

Textbook Question
Book Icon
Chapter 2, Problem 18P

Piecewise functions are sometimes useful when the relation-ship between a dependent and an independent variable cannot be adequately represented by a single equation. For example, the velocity of a rocket might be described by

v ( t ) = { 1 , 1 t 2 5 t 1100 5 t 50 t + 2 ( t 20 ) 2 1520 e 0.2 ( t 30 ) 0 0 t 10 10 t 20 20 t 30 t > 30 otherwise

Develop a well-structured function to compute v as a function of t. Then use this function to generate a table of v versus t for t = 5 to 50 at increments of 0.5

Expert Solution & Answer
Check Mark
To determine

To calculate: Create a function for the velocity of rocket v that takes t as parameters and test the function on the below piecewise function of velocity from t=5 and t=50 with increment of 0.5:

v(t)={11t25t0t1011005t10t2050t+2(t20)220t301520e0.2(t30)t>300otherwise

Answer to Problem 18P

Solution:

The value of v for t is:

Explanation of Solution

time velocity

-5.000000 0.000000

-4.500000 0.000000

-4.000000 0.000000

-3.500000 0.000000

-3.000000 0.000000

-2.500000 0.000000

-2.000000 0.000000

-1.500000 0.000000

-1.000000 0.000000

-0.500000 0.000000

0.000000 0.000000

0.500000 0.250000

1.000000 6.000000

1.500000 17.250000

2.000000 34.000000

2.500000 56.250000

3.000000 84.000000

3.500000 117.250000

4.000000 156.000000

4.500000 200.250000

5.000000 250.000000

5.500000 305.250000

6.000000 366.000000

6.500000 432.250000

7.000000 504.000000

7.500000 581.250000

8.000000 664.000000

8.500000 752.250000

9.000000 846.000000

9.500000 945.250000

10.000000 1050.000000

10.500000 1047.500000

11.000000 1045.000000

11.500000 1042.500000

12.000000 1040.000000

12.500000 1037.500000

13.000000 1035.000000

13.500000 1032.500000

14.000000 1030.000000

14.500000 1027.500000

15.000000 1025.000000

15.500000 1022.500000

16.000000 1020.000000

16.500000 1017.500000

17.000000 1015.000000

17.500000 1012.500000

18.000000 1010.000000

18.500000 1007.500000

19.000000 1005.000000

19.500000 1002.500000

20.000000 1000.000000

20.500000 1025.500000

21.000000 1052.000000

21.500000 1079.500000

22.000000 1108.000000

22.500000 1137.500000

23.000000 1168.000000

23.500000 1199.500000

24.000000 1232.000000

24.500000 1265.500000

25.000000 1300.000000

25.500000 1335.500000

26.000000 1372.000000

26.500000 1409.500000

27.000000 1448.000000

27.500000 1487.500000

28.000000 1528.000000

28.500000 1569.500000

29.000000 1612.000000

29.500000 1655.500000

30.000000 1520.000000

30.500000 1375.352875

31.000000 1244.470745

31.500000 1126.043695

32.000000 1018.886470

32.500000 921.926603

33.000000 834.193687

33.500000 754.809662

34.000000 682.980025

34.500000 617.985883

35.000000 559.176751

35.500000 505.964047

36.000000 457.815202

36.500000 414.248325

37.000000 374.827385

37.500000 339.157843

38.000000 306.882707

38.500000 277.678957

39.000000 251.254310

39.500000 227.344301

40.000000 205.709631

40.500000 186.133771

41.000000 168.420801

41.500000 152.393442

42.000000 137.891289

42.500000 124.769198

43.000000 112.895839

43.500000 102.152379

44.000000 92.431295

44.500000 83.635294

45.000000 75.676344

45.500000 68.474788

46.000000 61.958550

46.500000 56.062414

47.000000 50.727370

47.500000 45.900023

48.000000 41.532058

48.500000 37.579760

49.000000 34.003573

49.500000 30.767705

50.000000 27.839771

Given Information:

The piecewise function of velocity is given below on which the function will be executed from t=5 and t=50 with increment of 0.5:

v(t)={11t25t0t1011005t10t2050t+2(t20)220t301520e0.2(t30)t>300otherwise

Calculation:

Code:

% create a function vel_piecewise and pass a parameter t_val

function velocity=vel_piecewise(t_val)

% calculate the velocity on the basis of t_val.

ift_val<0

velocity =0;

elseift_val<10

velocity =11*t_val^2-5*t_val;

elseift_val<20

velocity =1100-5*t_val;

elseift_val<30

velocity =50*t_val+2*(t_val-20)^2;

else

velocity =1520*exp(-0.2*(t_val-30));

end

TestFile.m:

disp(' time velocity');

for x =-5:.5:50

y=vel_piecewise(x);

fprintf('%f %f\n',x,y)

end

Output:

Press F5 to run the program.

>>TestFile

time velocity

-5.000000 0.000000

-4.500000 0.000000

-4.000000 0.000000

-3.500000 0.000000

-3.000000 0.000000

-2.500000 0.000000

-2.000000 0.000000

-1.500000 0.000000

-1.000000 0.000000

-0.500000 0.000000

0.000000 0.000000

0.500000 0.250000

1.000000 6.000000

1.500000 17.250000

2.000000 34.000000

2.500000 56.250000

3.000000 84.000000

3.500000 117.250000

4.000000 156.000000

4.500000 200.250000

5.000000 250.000000

5.500000 305.250000

6.000000 366.000000

6.500000 432.250000

7.000000 504.000000

7.500000 581.250000

8.000000 664.000000

8.500000 752.250000

9.000000 846.000000

9.500000 945.250000

10.000000 1050.000000

10.500000 1047.500000

11.000000 1045.000000

11.500000 1042.500000

12.000000 1040.000000

12.500000 1037.500000

13.000000 1035.000000

13.500000 1032.500000

14.000000 1030.000000

14.500000 1027.500000

15.000000 1025.000000

15.500000 1022.500000

16.000000 1020.000000

16.500000 1017.500000

17.000000 1015.000000

17.500000 1012.500000

18.000000 1010.000000

18.500000 1007.500000

19.000000 1005.000000

19.500000 1002.500000

20.000000 1000.000000

20.500000 1025.500000

21.000000 1052.000000

21.500000 1079.500000

22.000000 1108.000000

22.500000 1137.500000

23.000000 1168.000000

23.500000 1199.500000

24.000000 1232.000000

24.500000 1265.500000

25.000000 1300.000000

25.500000 1335.500000

26.000000 1372.000000

26.500000 1409.500000

27.000000 1448.000000

27.500000 1487.500000

28.000000 1528.000000

28.500000 1569.500000

29.000000 1612.000000

29.500000 1655.500000

30.000000 1520.000000

30.500000 1375.352875

31.000000 1244.470745

31.500000 1126.043695

32.000000 1018.886470

32.500000 921.926603

33.000000 834.193687

33.500000 754.809662

34.000000 682.980025

34.500000 617.985883

35.000000 559.176751

35.500000 505.964047

36.000000 457.815202

36.500000 414.248325

37.000000 374.827385

37.500000 339.157843

38.000000 306.882707

38.500000 277.678957

39.000000 251.254310

39.500000 227.344301

40.000000 205.709631

40.500000 186.133771

41.000000 168.420801

41.500000 152.393442

42.000000 137.891289

42.500000 124.769198

43.000000 112.895839

43.500000 102.152379

44.000000 92.431295

44.500000 83.635294

45.000000 75.676344

45.500000 68.474788

46.000000 61.958550

46.500000 56.062414

47.000000 50.727370

47.500000 45.900023

48.000000 41.532058

48.500000 37.579760

49.000000 34.003573

49.500000 30.767705

50.000000 27.839771

>>

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
None
A newborn baby weighed 10 pounds at birth and was 15 inches tall. After 7 months the baby weighs 17 pounds and is 25 inches tall. Part A: a) Write a linear function W(t) to represent the baby’s weight in pounds (W) at t months of age. Enter exact answers only, no approximations. W(t)= Part B: Write a linear function H(t) to represent the baby’s height in inches (H) at t months of age. Enter exact answers only, no approximations. H(t)=
The amount of heat H (in joules) required to convert one gram of water into vapor is linearly related to the temperature T (in C) of the atmosphere. At 10C this conversion requires 2480 joules, and each increase in temperature of 15C lowers the amount of heat needed by 40 joules. Express H in terms of T.

Chapter 2 Solutions

EBK NUMERICAL METHODS FOR ENGINEERS

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Mechanical Engineering
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, mechanical-engineering and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Intermediate Algebra
Algebra
ISBN:9781285195728
Author:Jerome E. Kaufmann, Karen L. Schwitters
Publisher:Cengage Learning
Text book image
Algebra for College Students
Algebra
ISBN:9781285195780
Author:Jerome E. Kaufmann, Karen L. Schwitters
Publisher:Cengage Learning
Text book image
College Algebra
Algebra
ISBN:9781305115545
Author:James Stewart, Lothar Redlin, Saleem Watson
Publisher:Cengage Learning
Text book image
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:9781133382119
Author:Swokowski
Publisher:Cengage
Text book image
Intermediate Algebra
Algebra
ISBN:9780998625720
Author:Lynn Marecek
Publisher:OpenStax College
Text book image
College Algebra
Algebra
ISBN:9781938168383
Author:Jay Abramson
Publisher:OpenStax
Implicit Differentiation with Transcendental Functions; Author: Mathispower4u;https://www.youtube.com/watch?v=16WoO59R88w;License: Standard YouTube License, CC-BY
How to determine the difference between an algebraic and transcendental expression; Author: Study Force;https://www.youtube.com/watch?v=xRht10w7ZOE;License: Standard YouTube License, CC-BY