Value of x for which AUC reaches a given value
1 view (last 30 days)
Show older comments
Alessandra Piatti
on 18 Jan 2021
Commented: Star Strider
on 18 Jan 2021
Hello,
I need to find the point on the x axis where the AUC of a given curve reaches 50% of its value.
I calculate the AUC using the trapz function. I guess at this point I need a reverse formula to find the value of x there the AUC reaches a given value.
Could anybody please help me with that formula?
0 Comments
Accepted Answer
Star Strider
on 18 Jan 2021
‘I calculate the AUC using the trapz function.’
t = linspace(0, 1, 500); % Create Data
x = rand(size(t)); % Create Data
AUC = cumtrapz(t,x);
AUC50 = interp1(AUC, t, AUC(end)/2);
figure
plot(t, AUC)
hold on
plot(AUC50, AUC(end)/2, 'p')
hold off
text(AUC50, AUC(end)/2, sprintf('\\leftarrow AUC = %.2f at %.2f', AUC(end)/2, AUC50), 'HorizontalAlignment','left', 'VerticalAlignment','middle')
.
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!