Filter löschen
Filter löschen

Signal peak integration (signal processing)

10 Ansichten (letzte 30 Tage)
Shu-An Hsieh
Shu-An Hsieh am 17 Okt. 2022
Kommentiert: Kevin Holly am 28 Okt. 2022
I would like to integrate the peaks I have in this plot. I am looking for integrated the peak shown down below. I found a video of how I can do it in the origin software, but I am wondering if this is possible to do the same thing in matlab as well.
A few highlighted point in my plot is that is curve made by the data points are not smooth and also there are some broad peaks. An example file is attached. Thank you!
https://video.search.yahoo.com/video/play;_ylt=AwrFQy0dk01jVnkNy600nIlQ;_ylu=c2VjA3NyBHNsawN2aWQEZ3BvcwMyMw--?p=peak+area+integration+matlab&vid=85371a8ae2016ae6406443e99d571203&turl=https%3A%2F%2Ftse3.mm.bing.net%2Fth%3Fid%3DOVP.mTPp6eDERQsT9ZKpCYvHkgHgFo%26pid%3DApi%26h%3D360%26w%3D480%26c%3D7%26rs%3D1&rurl=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBtNl5vsl1WI&tit=%3Cb%3EPeak%3C%2Fb%3E+Analysis%3A+Origin+8.6%3A+Regional+%3Cb%3EPeak%3C%2Fb%3E+%3Cb%3EIntegration%3C%2Fb%3E&c=22&sigr=hOZpACMsGq4Q&sigt=Yt_u3iUZek01&sigi=Ux90M_gG59FI&fr=p%3As%2Cv%3Av&h=360&w=480&l=321&age=1321288991&fr=yhs-iba-syn&hsimp=yhs-syn&hspart=iba&type=asbw_8923_CHW_US_tid22076&param1=oBDEqCmKlAYtdwLl9JixRA4UHAG3BKV4TZg7uMGHQWHfAKDe5omiepuIRJDpUxz6&param2=9dUI1n2R0BLDxNuWfiP4aSFOTltNdSPoIx38%2BUf%2FiXrvPdoGmStdlfwLFZYDvqkAJrWWk4yNReCLnBD%2FqPsDZd7olTZcV8HMx1G%2Fk786sE2Tis1g8dJd8zxVWs%2BbKztBnq1TfqUiqPYK9pXifXmJFyorDuCsYXJE71Y6G5tfejDyqA%2FOOYcesmHQFjUmStkEZgOJ3ir4yNI9vw8lwAqcOquqFtE28iC1Y6rlayi2heMuYBKibyndi2xl%2BZvAVIduqG2iBj0J9HGPa83cjHY4LjbDPHlRWec7MxqqyfSvDMkCXjCVwi%2FbmltFGi0Pdb%2FA&param3=NwVEMR%2FzKcG52XsVBYEh2zk2Yklq85vdfspZPoqz2M1qypHRDDTed5vIiOf0QJloIYNIhURx5ygk43IbuWBmnfLApzQNuNyJQuCIFEosygzUObTBvpAdBKtFCFkedGtzXg8BZPONEY8XN9MMyOktF4upJPUjUDsQCabRsqT1bHoQfyzTr8RoM20UF%2BX8gFSQ%2BbtwVgPIiaJMNwoR5vAewaUndCkGrq%2FqoLUjBmVL7708NGMyxtn%2Fl9o%2BOfj%2FVmNF4Qm2YN9Mb8BkPy5nN52gO9jCpXSe6JgFRxPUj4BKDtQt8BrXhKVoQT1dUtpe0tR7CXghpkSUQQtlMGPA5RdeO%2FJpUpfs%2FdK2x7sIRpLNo9GW%2BTqFXdf%2BVbrLjpc07sZlfI6v0NR%2BehEVEK8hHCt5BzlR0PRysM0N3Ci%2F16iYWKKOt1W0%2BOwy9bJT7piW21HY&param4=RV6VDGT7tuWM%2FGPWJLeAv0ykzjGbyHSdEe3QQnVgKZ8%3D&tt=b

Antworten (1)

AH
AH am 20 Okt. 2022
Bearbeitet: AH am 20 Okt. 2022
You may want to try something like below
%% Signal Model
t = linspace(0,1.5,1000);
mu = [1 5 9 13]/10; % position
amp = [3 2 3 1]; % amplitude
sigma = [2 3 6 4]/100; % width
x = 0;
for n = 1:length(mu)
x = x + amp(n)*exp(-((t - mu(n))/sigma(n)).^2);
end
figure, plot(t,x), xlabel('Time [sec]'), ylabel('Amp.'), grid("on")
%% Find Peaks
[pks,locs,w] = findpeaks(x,t,...
'Annotate','extents',...
'WidthReference','halfheight');
%% Plot Peak Area
figure
plot(t,x,'LineWidth',2), xlabel('Time [sec]'), ylabel('Amp.'), grid("on")
ylim([min(x)-0.5,max(x)+0.5])
hold("on")
for n = 1:length(pks)
tstart = locs(n)-w(n);
tend = locs(n)+w(n);
ind = sort(find((t >= tstart) & (t <= tend)));
pax = [t(ind(1)),t(ind(1)),t(ind(end)),t(ind(end))];
pay = [min(x([ind(1),ind(end)])) pks(n) pks(n) min(x([ind(1),ind(end)]))];
patch(pax,pay,'yellow','FaceAlpha',0.3)
end
We can play with the factors of the width to cover the desired area manually and approximate the Riemann integral using functions like sum or trapz for each of the highlighted area.
  4 Kommentare
Shu-An Hsieh
Shu-An Hsieh am 20 Okt. 2022
Is there any GUI function you would recommend to use? Thank you!
Kevin Holly
Kevin Holly am 28 Okt. 2022
You can make your own with App Designer. Here is a proof of concept for you. Intergrate AH's code in the App attached.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by