hello
based on @Davide Masiello excellent proposition, I tried to make the selection of the peak zone a bit more automatic... the computation of the area of the peak may significantly vary based on where start and stop the selected segment , as how much of the root (being wider) will impact the result
this is how is works with the code below :
you can change the threshold (threshold_above_curve) to see the effect
A = readmatrix('875nm.txt');
threshold_above_curve = 0.25;
x_tmp = x(ind-window/2:ind+window/2);
y_tmp = y(ind-window/2:ind+window/2);
y_tmp_d = detrend(y_tmp);
y_tmp_d = y_tmp_d - min(y_tmp_d);
ind = find(y_tmp_d>threshold_above_curve);
area_peak = trapz(x_tmp(ind),y_tmp(ind))
plot(x,y,x_tmp(ind),y_tmp(ind),'r');