I am not certain what you want.
Try this:
D1 = load('EDA_pxx.mat');
EDA_pxx = D1.EDA_pxx;
D2 = load('w.mat');
w = D2.w;
ws(1,:) = [0, 0.045];
ws(2,:) = [0.045, 0.15];
ws(3,:) = [0.15, 0.25];
for k = 1:size(ws,1)
lv = w >= ws(k,1) & w <= ws(k,2);
wv{k} = w(lv);
pxxv{k} = EDA_pxx(lv);
AUC{k} = trapz(wv{k}, pxxv{k});
end
pchc = 'rgb';
figure
plot(w, EDA_pxx)
hold on
for k = 1:size(ws,1)
patch([wv{k}; flipud(wv{k})], [pxxv{k}; zeros(size(pxxv{k}))], pchc(k))
end
hold off
grid
fprintf('Area %d = %.3E\n', [1:3; [AUC{:}]])
producing:
Area 1 = 7.149E-05
Area 2 = 8.660E-05
Area 3 = 6.038E-05
and:
.
Best Answer