bruce mayer, pe registered electrical & mechanical engineer bmayer@chabotcollege.edu

Download Bruce Mayer, PE Registered Electrical & Mechanical Engineer BMayer@ChabotCollege.edu

Post on 24-Feb-2016

45 views

Category:

Documents

0 download

Embed Size (px)

DESCRIPTION

Engr/Math/Physics 25. Prob 4.12 Tutorial. Bruce Mayer, PE Registered Electrical & Mechanical Engineer BMayer@ChabotCollege.edu. Ballistic Trajectory. Studied in Detail in PHYS4A The Height, h, and Velocity, v, as a Fcn of time, t, Launch Speed, v 0 , & Launch Angle, A. h. A. t. t hit. - PowerPoint PPT Presentation

TRANSCRIPT

W A T K I N S - J O H N S O N C O M P A N Y Semiconductor Equipment Group

Bruce Mayer, PERegistered Electrical & Mechanical EngineerBMayer@ChabotCollege.eduEngr/Math/Physics 25Prob 4.12Tutorial

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsBallistic TrajectoryStudied in Detail in PHYS4AThe Height, h, and Velocity, v, as a Fcn of time, t, Launch Speed, v0, & Launch Angle, Aht

AthitBMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsParametric DescriptionFor This Problem

th309.81 m/s240 m/sFind TIMES for Three casesh ~< 15 mOr Equivalently: h 15m[h ~< 15 m] & [v ~> 36 m/s]Or By DeMorgans Theorem: ~([h 15m] | [v 36 m/s])[h < 5 m] I [v > 35 m/s]BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methodsmph = 89.48181st Step PLOT itAdvice for Every Engineer and Applied Mathematician or Physicist:Rule-1: When in Doubt PLOT IT!Rule-2: If you dont KNOW when to DOUBT, then PLOT EVERYTHING

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsThe Plot PlanThe Plot Portion of the solution File% Bruce Mayer, PE * 21Feb06% ENGR25 * Problem 4-12% file = Prob4_12_Ballistic_Trajectory.m%%% INPUT PARAMETERS SECTIONA = 30*pi/180; % angle in radiansv0 = 40 % original velocity in m/Sg = 9.81 % Accel of gravity in m/sq-S%%%CALCULATION SECTION% calc landing timet_hit = 2*v0*sin(A)/g;% divide flite time into 100 equal intervalst = [0: t_hit/100: t_hit];% calc Height & Velocity Vectors as fcn of th = v0*t*sin(A) - 0.5*g*t.^2v = sqrt(v0^2 - 2*v0*g*sin(A)*t + g^2*t.^2)%% plot h & v %% MUST locate H & S Labels on plot before script continuesplot(t,h,t,v), xlabel('Time (s)'), ylabel('Height & Speed'), gridThen the PlotAnalyses Follow

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsAnalyze the PlotsDraw HORIZONTAL or VERTICAL Lines that Correspond to the Constraint Criteria Where the Drawn-Lines Cross the Plotted-Curve(s) Defines the BREAK POINTS on the plotsCast DOWN or ACROSS to determine Values for the Break-PointsSee Next SlideBMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Case a.0.983.1

Break-PtsBMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Case b.1.13.05

v LimitsBMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Case c.1.492.58

v Limitsv LimitsBMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsAdvice on Using WHILE LoopsWhen using Dynamically Terminated Loops be SURE to Understand the MEANING of theThe LAST SUCEESSFULentry into the LoopThe First Failure Which Terminates the Loop

Understanding First-Fail & Last-Success helps to avoid Fence Post Errors

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsSolution Game Plan Calc t_hitPlot & Analyze to determine approx. values for the times in questionDONEPrecisely Determine time-pointsFor all cases Divide Flite-Time into 1000 intervals time row-vector with 1001 elementsCalc 1001 element Row-Vectors h(t) & v(t)BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsSolution Game Plan cont.Case-aUse WHILE Loops to Count k-UP (in time) while h(k) < 15mSave every time ta_lo = h(k)The first value to fail corresponds to the value of ta_lo for the Left-side Break-Point

Count m-DOWN (in time) while h(m) < 15mSave every time ta_hi = h(m)The first value to fail corresponds to the value of ta_hi for the Right-side Break-Point

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsSolution Game Plan cont.Case-b Same TACTICS as Case-aUse WHILE Loops to Count k-UP While h(k) < 15m OR v(k) > 36 m/sSave every time tb_lo = h(k) OR v(k)The Last Successful value of tb_lo is ONE index-unit LESS than the Left Break point add 1 to IndexFind where [h36] is NOT trueCount m-DOWN While h(k) < 15m OR v(k) > 36 m/s Save every time tb_hi = h(m) OR v(m)The Last Successful value of tb_hi is ONE index-unit MORE than the Right Break point subtract 1 from indexFind where [h36] is NOT true

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsSolution Game Plan cont.Case-c Same TACTICS as Case-bUse WHILE Loops to Count k-UP while h(k) < 5m OR v(k) > 35 m/sSave every time tc_lo = h(k) OR v(k)The Last Successful value of tc_lo IS the Left-side Break-Point as the logical matches the criteriaCount m-DOWN while h(m) < 5m OR v(m) > 35 m/sSave every time tc_hi = h(m) OR v(k)The Last Successful value of tc_hi IS the Right-side Break-Point as the logical matches the criteria

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsSolution Game Plan cont.MUST Properly LABEL the OutPut using the Just Calculated BREAK-PtsRecall from the Analytical PLOTSCase-a is ONE interval (ConJoint Soln)ta_lo ta_hiCase-b is ONE interval (ConJoint Soln)tb_lo tb_hiCase-c is TWO intervals (DisJoint Soln)0 tc_lo tc_hi t_hitBMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsAlternate Soln FIND Use FIND command along with a LOGICAL test to locate the INDICES of h associated with the Break PointsLOWEST index is the Left-BreakHIGHEST Index is the Right-BreakSame Tactics for 3 Sets of BreakPtsAgain, MUST label ProperlyMust INcrement or DEcrement found indices to match logical criteriaNeed depends on Logical Expression UsedBMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsCompare: WHILE vs FINDExamine Script filesProb4_12_Ballistic_Trajectory_by_WHILE_1209.mProb4_12_Ballistic_Trajectory_by_FIND_1209.mFIND is Definitely More COMPACT (fewer KeyStrokes)WHILE-Counter is More INTUITIVE Better for someone who does not think in Array IndicesBMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsCompare: WHILE vs FINDWhile vs Find; Which is Best?The best one is the one that WORKS in the SHORTEST amount of YOUR TOTAL-TIME

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsPortion of The m-file

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsFollowing are for projection onto WhiteboardBMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational MethodsPortion of Plot m-file

BMayer@ChabotCollege.edu ENGR-25_Programming-1.ppt#Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods