Lecture 9 Slides - 10/12/2010

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
10/12/2010 1 Problem: An object is shot upwards with an initial velocity of v 0 m/s. Its height h (in m) after t seconds is given by where is a drag coefficient and g is981 m/ 2  r gt e r g v r h rt 1 1 0 r is a drag coefficient and g is 9.81 m/s . If r = 0.35 s 1 and v 0 = 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 it’s 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
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10/12/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 (doesn’t require function to handle vectors): >> t = linspace(0,12,100); >> h = ones (size(t)); % preallocate for efficiency >> fori= 1 : length(t) h(i) = objectHeight(v0, r, t(i)); end >> plot (t,h) 80 100 120 0 20 40 60 Height (metres) 0 2 4 6 8 10 12 -40 -20 Time (seconds)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/18/2010 for the course ECOR2606 2606 taught by Professor Aaaa during the Spring '10 term at Carleton CA.

Page1 / 6

Lecture 9 Slides - 10/12/2010

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online