This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 2/3/2010 1 Problem: An object is shot upwards with an initial velocity of v m/s. Its height h (in m) after t seconds is given by where is a drag coefficient and g is 9 81 m/ 2 r gt e r g v r h rt 1 1 where r is a drag coefficient and g is 9.81 m/s . If r = 0.35 s 1 and v = 78 m/s (i) When will be object be 80m above the ground? (ii) When will the object hit the ground? (iii) What maximum height will be attained? function [ height ] = objectHeight( v0, r, t ) % OBJECTHEIGHT Calculates height of an object shot vertically. A good first step in solving the problem is to implement the key equation as a function m file (although its admittedly on the simple side and an anonymous function could also be used). % Inputs: v0 = initial velocity (in m/s) % r = drag coefficient (in 1/s) % t = time (in s), cannot be zero % Outputs: height = height of object if r == 0 error ('zero drag coefficients are not allowed'); end g = 9.81; % gravity height = (1 / r) * (v0 + g/r) * (1 exp( r * t)) g * t / r; end 2/3/2010 2 >> v0 = 78; r = 0.35; One way of plotting the function: >> hFunc = @(t) objectHeight (v0, r, t); >> fplot (hFunc, [0 12]); Another way (works because the function can deal with a vector of times): >> t = linspace(0,12,100); >> h = objectHeight (v0, r, t); >> plot (t, h); Yet another way (doesnt require function to handle vectors): >> t = linspace(0,12,100);...
View Full Document
- Winter '09