To calculate the area under a series of curves
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Vahid Esmaeili
el 28 de Jul. de 2020
Comentada: Star Strider
el 29 de Jul. de 2020
Hello,
Would you please assist me to calculate the area under different sections of the curves of FR2_.mat? The sections are IC, LR, MS, TS, PS, P50, TOR.
The following lines calculate different sections of the curve like the photo attached to the question.
cycl=13;
for i=1:length(cycl)
if length(i+5)>length(FR2_)
break
end
LR(i)=find(FR2_(i,:)==max(FR2_(i,1:40)));
for j= LR:70
if FR2_(i,j+1)> FR2_(i,j)
MS(i)= find(FR2_(i,:)==( FR2_(i,j)));
end
end
end
for i=1:length(cycl)
IC(i)=find(FR2_(i,:)==min(FR2_(i,1:3)));
LR(i)=find(FR2_(i,:)==max(FR2_(i,1:40)));
TS(i)=find(FR2_(i,:)==max(FR2_(i,MS(i):85)));
PS(i)=find(FR2_(i,:)==max(FR2_(i,TS(i):99)));
P50(i)=find(FR2_(i,:)==min(FR2_(i,49:51)));
TOR(i)=find(FR2_(i,:)==min(FR2_(i,97:99)));
end
Also, there is a FL2_.mat. I have to find the points of FL2_.mat the correspond to the "IC, LR, MS, TS, PS, P50, TOR" points of FR2_. Then, I have to calculate area under these sections as well.
I appreciate your attention to this question.
Vahid,
0 comentarios
Respuesta aceptada
Star Strider
el 28 de Jul. de 2020
First, the for loops should both be:
for i = 1:cycl
The areas calculation appears to be straightforward:
for i=1:cycl
AUC = cumtrapz(FR2_(i,:));
IC(i)=find(FR2_(i,:)==min(FR2_(i,1:3)));
LR(i)=find(FR2_(i,:)==max(FR2_(i,1:40)));
TS(i)=find(FR2_(i,:)==max(FR2_(i,MS(i):85)));
PS(i)=find(FR2_(i,:)==max(FR2_(i,TS(i):99)));
P50(i)=find(FR2_(i,:)==min(FR2_(i,49:51)));
TOR(i)=find(FR2_(i,:)==min(FR2_(i,97:99)));
Areas(i,:) = diff(AUC([IC(i) LR(i) TS(i) PS(i) P50(i) TOR(i)]));
end
See if that does what you want.
.
4 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Linear Algebra en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!