# AREA UNDER the CURVE

8 views (last 30 days)
mohd akmal masud on 12 Dec 2019
Commented: Star Strider on 13 Dec 2019
Hi every one..
How to calculate area under curve? i used this code
surf(X(59:69,71:85))
the curve picture like below.
this is my data
529 589 644 707 796 940 1072 1143 1128 989 805 632 509 439 408
486 579 702 881 1177 1560 1895 2034 1908 1537 1112 773 562 462 421
468 600 808 1170 1773 2572 3190 3356 3050 2343 1540 942 622 484 442
474 642 952 1538 2487 3649 4480 4713 4272 3215 1990 1126 682 502 449
493 700 1102 1866 3056 4328 5239 5480 5006 3816 2346 1268 719 519 465
509 735 1153 1956 3151 4394 5291 5540 5141 4012 2454 1289 723 526 472
504 704 1068 1731 2736 3852 4682 4898 4557 3474 2125 1139 671 505 451
485 637 901 1363 2073 2902 3508 3634 3245 2394 1470 866 568 456 420
477 578 745 1020 1434 1926 2200 2193 1897 1414 940 637 480 420 398
474 536 635 780 992 1190 1258 1197 1062 853 656 519 442 407 390
467 501 554 636 736 792 781 741 689 606 527 480 450 420 395

Star Strider on 12 Dec 2019
Defining your matrix as ‘M’, use the trapz function twice, once in each dimension:
AUC = trapz(trapz(M))
producing:
AUC =
236001.75

Star Strider on 13 Dec 2019
Without the ‘x’ and ‘y’ vectors (that define the x and y coordinates), trapz defaults to 1 for the intervals of the independent variable.
Defining the x and y vectors gives an appropriately different result.
Example
x = linspace(1, 500, size(M,1));
y = linspace(-5, 5, size(M,2));
AUC = trapz(y,trapz(x,M))
produces:
AUC =
8411776.66071429
See the documentation on trapz for details.
mohd akmal masud on 13 Dec 2019
oh i see..but how to extract all the pixel value? i have try thid code but the result not show the pixel value
Y=find(X(58:70,70:84));
Star Strider on 13 Dec 2019