필터 지우기
필터 지우기

How can I create an idealized cycle from quasiperiodic data?

조회 수: 3 (최근 30일)
Samuel Harvey
Samuel Harvey 2021년 8월 11일
댓글: Star Strider 2021년 8월 30일
I have data of blood velocity (attached) over several cardiac cycles. I'm trying to create a single idealized cycle that takes into account the natural variations in duration and velocity from cycle to cycle, while removing the noise. This is what the data looks like at the moment:
The standard way I've done it in the past is to manually pick points over a single cycle, then interpolate them. The blue interpolated line is roughly what I'm looking for as an output.
Is there any way I can create this kind of idealized cycle from the data I have?

채택된 답변

Star Strider
Star Strider 2021년 8월 11일
This is called ‘ensemble averaging’. See for example Combining repetitive curves into one average curve and similar posts.
Try this —
LD = load('normalized_velocities.mat');
norm_values = LD.norm_values;
t = 1:numel(norm_values);
plocs = find(islocalmax(norm_values, 'MinProminence',0.1));
plocs = [plocs numel(t)];
vlocs = find(islocalmin(norm_values, 'MinProminence',0.005));
for k = 1:numel(plocs)-1
ixm(k) = max(vlocs(vlocs<plocs(k))); % Min Before Peak
end
% for k = 1:numel(ixm)-1
% ix{k} = ixm(k):ixm(k+1);
% pulse{k} = norm_values(ix{k});
% n(k) = numel(ix{k});
% end
for k = 1:numel(ixm)-1
ix{k} = plocs(k)-11:ixm(k+1);
pulse{k} = norm_values(ix{k});
n(k) = numel(ix{k});
end
ens = zeros(1,max(n)); % Preallocate
for k = 1:numel(pulse)
ens(k,1:n(k)) = pulse{k}(1:n(k));
end
ensavg = mean(ens,'omitnan');
figure
plot(t, norm_values,'.-')
hold on
plot(t(plocs), norm_values(plocs), '^r')
plot(t(vlocs), norm_values(vlocs), 'vg')
hold off
grid
figure
plot((0:max(n)-1), ens, '.-')
grid
figure
plot((0:max(n)-1), ensavg)
grid
producing:
Experiment to get the result you want.
.
  댓글 수: 7
Samuel Harvey
Samuel Harvey 2021년 8월 30일
Sorry, let me clarify. The issue with using zeros for placeholders is that at the tail end of the cycle those zeros are being treated as data points and affecting the average. Each curve is a slightly different length, so at the tail end it ends up averaging values from the longer curves with the zeros instead of only using existing data points. You can see in your figure that the idealized cycle drops off sharply at the very end, but that goes away when NaN values are used.
Star Strider
Star Strider 2021년 8월 30일
O.K.
The initial ‘ens’ vector is created to correspond to the maximum length of the discovered waveform segments, so it should be no longer than the longest one.
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by