Chp3 Tutorial: Prob 3.14 Solution

Slides:



Advertisements
Similar presentations
ENGR-22_Lec-17_Dimensioning-2.ppt 1 Bruce Mayer, PE Engineering 22 – Engineering Design Graphics Bruce Mayer, PE Licensed Electrical.
Advertisements

ENGR-45_Prob_3-5_3-12_2-16_Lab.ppt 1 Bruce Mayer, PE Engineering-45: Materials of Engineering Bruce Mayer, PE Licensed Electrical.
Lecture 5.
ENGR-25_Plot_Model-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENGR-25_Plot_Model-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENGR-25_TYU_chp02.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
E ENGR-25_Chp2_AirCraft_Separation_.pptx 1 Bruce Mayer, PE Engineering-25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer.
Registered Electrical & Mechanical Engineer
ENGR-25_Plot_Model-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENGR-25_Prob_9_3_Solution.ppt 1 Bruce Mayer, PE Engineering-25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer
ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx 1 Bruce Mayer, PE Engineering-43: Engineering Circuit Analysis Bruce Mayer,
ENGR-25_Prob_9_3_Solution.ppt 1 Bruce Mayer, PE Engineering-25: Computational Methods P1-26 Law of CoSines  Given Irregular Quadrilateral  By Law of.
MTH16_Lec-19_sec_10-3_Taylor_Series.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
ENGR-25_Lec-29_MS_Excel-2.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
ENGR-25_Lec-25_SimuLink-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-21_sec_11-2_Continuous_PDFs.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 19P. 1Winter Quarter MATLAB: Script and.
ENGR-25_HW-01_Solution.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
MTH55_Lec-13_sec_3-3a_3Var_Lin_Sys.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH55_Lec-07_sec_2-3a_Lines_by_Intercepts.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-14_sec_10-1_Infinite_Series.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-14_sec_3-2_Concavity_Inflection_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH55_Lec-19_sec_4-4_2Var_InEqualities.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
ENGR-25_HW-01_Solution.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENGR-25_MTExam_Logisitics.pptx 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-21_sec_11-2_Continuous_PDFs.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH55_Lec-36_sec_6-8_Model_by_Variation.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH15_Lec-10_sec_2-5_Incrementals_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH55_Lec-10_sec_3-1_2Var_LinSys_ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH15_Lec-12_sec_3-1_Rel_Extrema_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH55_Lec-46_sec_7-6b_2Var_Radical_Eqns.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH15_Lec-11_sec_2-6_Implicit_Diff_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
MTH55_Lec-29_Fa08_sec_6-1_Rational_Fcn_Mult-n-Div.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
ENGR-25_EXCEL_Integration_Tutorial-Example.pptx 1 Bruce Mayer, PE ENGR/MTH/PHYS25: Computational Methods Bruce Mayer, PE Registered.
MTH55_Lec-65_Fa08_sec_9-5b_Logarithmic_Eqns.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH55A_Lec-05_sec_2-2_Fcn_Graphs.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
ENGR-36_Lab-24_Fa07_Lec-Notes.ppt 1 Bruce Mayer, PE Engineering-36: Engineering Mechanics - Statics Bruce Mayer, PE Licensed Electrical & Mechanical Engineer.
Chapter 6 Review: User Defined Functions Introduction to MATLAB 7 Engineering 161.
ENGR-25_Prob_10-25_Catenary_Solution.ppt.ppt 1 Bruce Mayer, PE ENGR/MTH/PHYS25: Computational Methods Bruce Mayer, PE Registered.
ENGR-25_Programming-4.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 1 Bruce Mayer, PE Licensed Electrical.
ENGR-25_Prob_2-24_Solution.ppt 1 Bruce Mayer, PE ENGR/MTH/PHYS25: Computational Methods Bruce Mayer, PE Registered Electrical.
ENGR-25_Prob_6-12_Solution.ppt 1 Bruce Mayer, PE Engineering-25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer
MTH55_Lec-45_7-6a_Radical_Equations.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH15_Lec-21_sec_4-4_EXP-n-LOG_Applications.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
ENGR-25_HW-01_Solution.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENGR-25_Lec-21_Integ_Diff.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENGR-25_Programming-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Registered Electrical.
File = MTH55_Lec-04_ec_2-2_Fcn_Algebra.pp 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical Engineer
ENGR-25_HW-01_Solution.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
© ENGR-43_Prob_14-32_OpAmp_OutPut_Current.pptx 1 Bruce Mayer, PE Engineering-43 Electrical Circuits & Devices Bruce Mayer, PE.
File = MTH55_Lec-04_ec_2-2_Fcn_Algebra.pp 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical Engineer
ENGR-25_HW-01_Solution.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
ENGR-25_Linear_Regression_Tutorial.ppt 1 Bruce Mayer, PE Engineering-25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer.
Licensed Electrical & Mechanical Engineer
Chp4 Tutorial: Prob 4.25 Solution
Catenary Tutorial Part-2
Licensed Electrical & Mechanical Engineer
Licensed Electrical & Mechanical Engineer
Chp3 Tutorial: Prob 3.15 Solution
Lab-23 Chp10 Beam VM Diagrams By Calculus
Chp3 Nodal Analysis & MATLAB
Chp4, Lab-03 Example Problems 4.5.[60,54]
Licensed Electrical & Mechanical Engineer
Chp12 Prob Solution Common-Source pFET Amplifier
Licensed Electrical & Mechanical Engineer
Prob 9-28 Solution Tutorial
Presentation transcript:

Chp3 Tutorial: Prob 3.14 Solution Engineering 25 Chp3 Tutorial: Prob 3.14 Solution Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu

P3.14 Water Reservoir Vol Using estimates of rainfall, evaporation, and water consumption, the town engineer developed the following model of the water volume in the reservoir as a function of time where V is the water volume in liters, t is time in days, and r is the town's consumption rate in liters per day. Write TWO user-defined functions. The first function should define the function V(t) for use with the fzero function. The second function should use fzero to compute how long it will take for the water volume to decrease to x percent of its initial value of 109 L. The inputs to the second function should be x and r. Test your functions for the case where x = 50 percent and r = 107 L/day.

A NearBy Reservoir http://www.pedalpushersonline.com/?CID=844

A NearBy Reservoir http://www.pedalpushersonline.com/?CID=844 This 315-acre anglers oasis sits in the heart of Suburban Castro Valley but, you'd never know it from your surroundings once inside the park. Miles of parkland and trails make Chabot a haven for outdoor enthusiasts. Hikers can enjoy scenic walks on the 280-acre Fairmont Ridge. Park trails are designed for shared useage. Lake Chabot is well known among the running community. The park hosts Half Marathons, 5K's and the Kids Fun Run. In fact, Trail Runner magazine chose this setting as one of America's Most Scenic Races.

Water Reservoir Vol Problem 3-14 appears to have an inconsistency The fzero built-in function operates on any SINGLE VARIABLE function as described in Tab 3.2-1 of the text book. In this case want to input a V(t), function, NOT a V(t,x,r) function to determine the %-decrease time. The problem, however, says that TWO parameters, x & r, must also be sent to the V(t) function before using fzero

Use GLOBALS for x&r We can “work around” the fzero single-varialbe requirement for V(t) by declaring x & r as GLOBAL Variables as described on pg 124 of the Text Declaring x & r as globals in BOTH the calling function and the V(t) function gives the single-Var function, V(t), access to r & x withOUT listing them in the V-function argument

Physical Analysis The Reservoir Volume vs t Function Now need to find the time, td, for the volume to decrease TO x-percent of the initial Volume for a given water consumption rate, r i.e, Find td such that

Physical Analysis Now need to define a function for which zeros exist In this case define a DIFFERENCE Function Want to ZERO Vguess - Vcalc Now ΔV will be ZERO when t = td so that V(td) = Vfinal Thus the function to be zeroed is the DIFFERENCE between Vfinal (the Goal) and V(t) (the Guess) Want: Vgoal − Vguess = 0

Guess&Check Demo Make a Time Guess, tGuess Calc VGuess = V(tGuess) Calc % Full for the Guess Calc Difference Guess AGAIN

Guess&Check Demo First Trial Run (Cmd Window) >> r = 1e7 r = 10000000>> >> VtoverVi = @(t) (1e9 + 1e8*(1 - exp(-t/100)) - r*t)/1e9 VtoverVi = @(t)(1e9+1e8*(1-exp(-t/100))-r*t)/1e9 >> Goal = 0.55 Goal = 0.5500 >> Guess31 = VtoverVi(31) Guess31 = 0.7167 >> del31 = Goal - Guess31 del31 = -0.1667

Guess & Check Ans >> P3_14_ReservoirVolume_1302 r = 10000000 VtoverVi = @(t)(1e9+1e8*(1-exp(-t/100))-r*t)/1e9 Goal = 0.5500 Guess31 = 0.7167 del31 = -0.1667 Guess62 = 0.4262 del62 = 0.1238 Guess47 = 0.5675 del47 = -0.0175 Guess48 = 0.5581 del48 = -0.0081 Guess49 = 0.5487 del49 = 0.0013

Guess&Check .m-file % Bruce Mayer, PE % ENGR25 * 12Feb13 % Problem 3_14 % P3_14_ReservoirVolume_1302.m r = 1e7 % consumption rate % Create ANON fcn to return % of Initial Vol VtoverVi = @(t) (1e9 + 1e8*(1 - exp(-t/100)) - r*t)/1e9 Goal = 0.55 % to 55% of initial Volume Guess31 = VtoverVi(31) del31 = Goal - Guess31 Guess62 = VtoverVi(62) del62 = Goal - Guess62 Guess47 = VtoverVi(47) del47 = Goal - Guess47 Guess48 = VtoverVi(48) del48 = Goal - Guess48 Guess49 = VtoverVi(49) del49 = Goal - Guess49

MATLAB GamePlan Write the single variable (var = t) function deltaV(t) for use in fzero This function receives parameters r & x as GLOBAL variables rd & xd Write the calling function, time_to_decrease(x,r), that calls into action fzero with deltaV as its argument This calling function sends rd & xd to deltaV by way of the GLOBAL declaration

Structure Chart Note How GLOBALS ByPass the Normal Communication Path

Fcn deltaV.m

time_to_decrease(x,r).m Only 4 active commands

The Calling Program

Example Call User Inputs x = 50 & r = 1e7 Takes 54.2 days to drop to 50% initial for use rate of 1e7 Liters per Day Percent of Initial Storage, x = 50 Consumption Rate in L/day, r = 1e7 for x = 50 for r = 10000000 The time to Decrease in Days = 54.1832

Cmd Window Session For x = 50%, and r = 1e7 liters per day >> td50_1e7 = time_to_decrease(50,1e7) Rd = 10000000 Xd = 50 t_dec = 54.1832 td50_1e7 = Thus for a 1e7 liter/day consumption rate, a 50% decrease in volume takes about 54 days

Cmd Window Session For x = 27%, and r = 4e6 liters/day >> td27_4e6 = time_to_decrease(27,4e6) Rd = 4000000 Xd = 27 t_dec = 204.2576 td27_4e6 = Thus for a 4e6 liter/day consumption rate, a decrease to 27% of the initial volume takes about 204 days

DeltaV Plot Anonymous fcn For x = 27%, and r = 4e6 liters/day dV = Goal – Guess Goal = 1e9*(27/100) Guess = (1e9 + 1e8*(1-exp(-tg/100)) - 4e6*tg); >> dV27_4e6 = @(tg) (1e9*(1-73/100 )) - (1e9 + 1e8*(1-exp(-tg/100)) - 4e6*tg); % Vfinal - Vguess >> tplot = linspace(-350,350,700); >> VolDiff = dV27_4e6(tplot); >> plot(tplot, VolDiff, 'LineWidth', 3), grid, xlabel('t (days)'), ylabel('DeltaV (L)'), title('P3-14: Need to ZERO‘)

DeltaV Plot Note that fzero can Return ERRONEOUS (negative) Results if Start-Pt is Off

Erroneous result For x = 65%, and r = 1e6 liters/day >> td65_1e6 = time_to_decrease(65,1e6) Rd = 1000000 Xd = 65 t_dec = -184.8166 td65_1e6 = For THIS SET of Parameters fzero found a NEGTIVE (erroneous Root)

Erroneous DeltaV Plot fzero found the negative root When in Doubt PLOT it fzero found the negative root The can be fixed by changing the starting point to 200

Erroneous result For x = 65%, and r = 1e6 liters/day Change This Line in the time_to_decrease code t_dec = fzero('deltaV', 200) The new (Mathimatically Correct) result >> td65_1e6 = time_to_decrease(65,1e6) Rd = 1000000 Xd = 65 t_dec = 448.8765 td65_1e6 =

Erroneous Comment Even though 448.9 Days is correct by the Equation, it is NOT physically reasonable Since Weather is CYCICAL on a 365 day basis, anything over a Year violates nature and is thus NOT Applicable Some Advice Always do a Reality Check on the Results returned by ANY computer program When in Doubt PLOT