MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by AstroandreaNASA on 30 Apr 2013

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

*No products are associated with this question.*

Answer by the cyclist on 30 Apr 2013

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)

## 0 Comments