Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Interpreting MATLAB's in-built trapezoidal rule
Date: Tue, 2 Oct 2012 05:01:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 26
Message-ID: <k4dsek$5r6$1@newscl01ah.mathworks.com>
References: <k43df8$bt7$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1349154068 5990 172.30.248.37 (2 Oct 2012 05:01:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 2 Oct 2012 05:01:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2158020
Xref: news.mathworks.com comp.soft-sys.matlab:779664

"Jac " <jac_domney@hotmail.com> wrote in message <k43df8$bt7$1@newscl01ah.mathworks.com>...
> Hey all,
> I am faced with this task:
> Extract the world population growth rate date from “Population Growth Rate.csv”. 
> Given that the initial population at year 1950 is  2532229237. Integrate the world 
> population growth rate from 1950-2010 at 1 year interval to obtain the world’s 
> population. You should apply cumulative integration using trapezoidal rule.
> 
> The growth rate numerical data are all percentages, and range from 0 to 2.
> After fiddling around i get a row vector with 61 columns.
> 
> If I call my row vector A
> and then go:
> B = trapz(A)
> 
> I get an answer of approx 99.9.
> 
> What does this answer signify and how do i apply it to find the population for 2010?
> 
> Any help to greater my understanding would be muchly appreciated. Thanks!

Wikipedia is a good place to start to learn more about the trapezoidal rule. Also, the function you call, TRAPZ, is pretty short and seems easy enough to read. Type "edit trapz" into the command line and check it out!

I have not looked at the function, but I assume it uses a composite trapezoid rule for the points you feed it (given by the row vector). So for some points, you have the solution of the integral (area under the curve ~ 99.9). 

For the next question, we have integral(f(x), dx, 1950, 2010) = F(2010) - F(1950), where F'(x) = f(x) (see: Fundamental Theorem of Calculus). Then you have the solution of the integral as well as F(1950), that is, the population in 1950, so there ya go.