I have a data set from an ORAS analyzer. It gives a cyclic pattern. i want to take each cycle and plot on top it ?

4 Ansichten (letzte 30 Tage)
my dataset plots like this
i want to take each repeating cycle and plot on top of other.
like this below
  1 Kommentar
Mathieu NOE
Mathieu NOE am 8 Mär. 2022
hello
you can use findpeaks to locate the peaks of your signal
then define the buffer length around the peaks (like a mean value of the time difference between peaks)
and extract each individual buffer according to peak location and buffer length

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Mathieu NOE
Mathieu NOE am 8 Mär. 2022
hello again
a demo code below (data file in attachement)
hope it helps
clc
clearvars
data = readmatrix('data.txt');
time = data(:,1);
data = data(:,2);
figure(1);
plot(time,data);
[pks,loc] = findpeaks(data,'MinPeakHeight',5);
text(time(loc)+.2,pks,num2str((1:numel(pks))'));
% overlay individual peaks data
data_half_length = floor(0.5*mean(diff(loc)));
figure(2);
hold on
for ci = 1:numel(loc)
ind_start = max(1,loc(ci)-data_half_length);
ind_stop = min(length(data),loc(ci)+data_half_length);
plot(data(ind_start:ind_stop));
end
xlabel('samples');
ylabel('Amplitude');
title('Overlayed data plot');
hold off

Community Treasure Hunt

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

Start Hunting!

Translated by