Path: news.mathworks.com!not-for-mail
From: "leo nidas" <bleonidas25@yahoo.gr>
Newsgroups: comp.soft-sys.matlab
Subject: Re: trapz, numerical integration
Date: Sun, 7 Jun 2009 08:40:17 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <h0fudh$pfo$1@fred.mathworks.com>
References: <h048vl$2v$1@fred.mathworks.com> <h04bpo$2vo$1@fred.mathworks.com>
Reply-To: "leo nidas" <bleonidas25@yahoo.gr>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1244364017 26104 172.30.248.37 (7 Jun 2009 08:40:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 7 Jun 2009 08:40:17 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1194208
Xref: news.mathworks.com comp.soft-sys.matlab:545297



Thanx John,

I downloaded quadgr that seemed better than others if one wanted to integrate till Inf.

But consider the case:

b0=-5;
b1=3;
m=3

pc=  quadgr(@(t) exp(b0+b1.*t)./(1+exp(b0+b1.*t)).*1/m.*exp(-t./m),0,Inf)

%plot the function I want to integrate:
gr=0:0.01:30;
plot(gr,exp(b0+b1.*gr)./(1+exp(b0+b1.*gr)).*1/m.*exp(-gr./m))



Quadgr doesn't seem to work here. I know that if I use trapz I could get a proper approximation but I need the integration untill Inf because my code is in a for loop and a new function (of the above form) to be integrated comes up. I.e. tha b0, b1, m may be different in each iteration with m>0.

Thanx again for any help.