Find the limits of integration for a known area ! HELP!

Hey. Any help would be really appreciated .
I'm trying to make a program but i don't even know how to start.
This is the problem:
I already have a script that computes this integral with b given.
integral (e^((-x)^2))/sqrt(pi) dx from x=0 to b *
Now I need to make one which uses the fact of a known area under the curve so i can compute b !
Thanks in advance
A

Answers (1)

Here is an example where instead of your function, I did a simpler one (the area under the line y = x). You should be able to just swap in your function for F.
% This function calculates the area under the curve for the function f(x) = x
F = @(x) 0.5*x.^2;
% Suppose the desired area is 4.5 The function G will be zero when the area
% under the curve is 4.5
G = @(x)(F(x) - 4.5);
% This will find the critical value of x (which you have called "b") for which
% G is zero, which gives the area under the curve you want.
b = fzero(G,1)

1 Comment

Hey,
can fzero also be used to find the upper limit b of a known integral of a fitted function?
This is my problem:
I have a 8-term Gaussian model and want to find the upper limit of the integral where the area under the curve is 50% of the total area under the curve.
My function looks like this:
f1(x) = a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2) + a3*exp(-((x-b3)/c3)^2) + a4*exp(-((x-b4)/c4)^2) + a5*exp(-((x-b5)/c5)^2) + a6*exp(-((x-b6)/c6)^2) + a7*exp(-((x-b7)/c7)^2) + a8*exp(-((x-b8)/c8)^2)
By integrating with quad(f1,a,b) I know that the total area is about 113. 50% of the area (113/2=56.5) are reached at an x-value of about 1.6 (found out by iterative substitution of b in the quad function).
I tried to use fzero to solve this problem but did not get the correct solution.
>> G = @(x)(f1(x) - 56.5);
b = fzero(G,1)
b =
1.2684
Can I use fzero for this problem or do I have to use another function?
Thanks in advance!
JK

Sign in to comment.

Asked:

on 30 Apr 2013

Commented:

on 20 May 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!