I have a PSD plot and I am trying to calculate the area between the two curves in MATLAB for two separate ranges of frequencies (8-30 Hz and 70-100 Hz). One area calculation per frequency range.
To calculate the area between the curves for all sections in each frequency range I use:
r1=(f>=8 & f<=30);
r2=(f>=70 & f<=100);
areaLF = trapz(f(r1),Z(r1)-Zm(r1));
areaHF = trapz(f(r2),Z(r2)-Zm(r2));
f=frequency and Zm, Z represent Z-scores of the two conditions (normalized power).
I can calculate the area between the curves for all areas between the curves in each frequency range, but I only want to calculate the area in the low frequency range for when Zm < Z and when Z > Zm for higher frequencies (the shaded regions in the plot).
Does someone have a suggestion about how to do this?
This is the plot showing the areas I am trying to calculate: