- #1
rebelsnake
- 1
- 0
Area under Curve REVERSED!
ok now I have got a plot b/w x & y, which produced a curve
using trapz function I evaluated the area
now the important thing is that I have to take say 10% of the evaluated area & want to find at which coordinates 10% of the caculated area approaches to; similarly which coordianes correspond to 20% 30% of the original calculated area
Code is
x=[0.8 0.7125 0.6375 0.534 .381 0]
x =
0.8000 0.7125 0.6375 0.5340 0.3810 0
>> conversion=x;
>> y=[1/0.4 1/.8 1/1.2 1/2 1/4 0]
y =
2.5000 1.2500 0.8333 0.5000 0.2500 0
>> rate=y;
>> plot(conversion,rate)
>> color=[010];
>> basey = min(0,min(y));
h = fill([x x(end) x(1)], [y basey basey], color);
>> %area under curve shaded
>> area=trapz(conversion,rate)
area =
-0.4162
>> area=trapz(conversion,-rate)
area =
0.4162
ok now I have got a plot b/w x & y, which produced a curve
using trapz function I evaluated the area
now the important thing is that I have to take say 10% of the evaluated area & want to find at which coordinates 10% of the caculated area approaches to; similarly which coordianes correspond to 20% 30% of the original calculated area
Code is
x=[0.8 0.7125 0.6375 0.534 .381 0]
x =
0.8000 0.7125 0.6375 0.5340 0.3810 0
>> conversion=x;
>> y=[1/0.4 1/.8 1/1.2 1/2 1/4 0]
y =
2.5000 1.2500 0.8333 0.5000 0.2500 0
>> rate=y;
>> plot(conversion,rate)
>> color=[010];
>> basey = min(0,min(y));
h = fill([x x(end) x(1)], [y basey basey], color);
>> %area under curve shaded
>> area=trapz(conversion,rate)
area =
-0.4162
>> area=trapz(conversion,-rate)
area =
0.4162