Integrate and find area under curve

2 views (last 30 days)
Reddington Tara
Reddington Tara on 20 Mar 2020
Commented: Devineni Aslesha on 23 Mar 2020
I am trying to recreate an example given to us in class, my professor told us to integrate the function graphically then find the area under the curve. The function is 1/[C^1+1/0.95 * 50*exp(-.0.2*C)], our C values are 0.5, 1, 5, 10, 20, 30, 40, 50. He gave us our 1/F(c ) values of 4.191, 1.020, 0.041, 0.011, 0.0032, 0.0017, 0.0011, and 0.0009.
This is how I was attempting it in matlab:
x=[0.5 1 5 10 20 30 40 50];
y=1./((x.^(1+1/0.95)).*50.*(exp(-0.02.*x)))
plot(x,y)
Int= trapz(x,y)
The answer I got was:
y =
0.0838 0.0204 0.0008 0.0002 0.0001 0.0000 0.0000 0.0000
Int =
0.0734
I don't know if I am doing it wrong.
  3 Comments
Reddington Tara
Reddington Tara on 20 Mar 2020
Sriram,
My professor's example has -0.02 not -0.2.
Devineni Aslesha
Devineni Aslesha on 23 Mar 2020
The problem is with the way the function 'y' is defined in MATLAB as 1/y gives different results comapared to 1/F(c). Please check if the function is defined correctly.

Sign in to comment.

Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!