How to upsample an ECG signal and its associated data?
조회 수: 6 (최근 30일)
이전 댓글 표시
I have an ECG signal which has a sampling frequency of 250 Hz and I want to upsample it to 360 Hz.
The signal has peaks and the indexes of the peaks are also given as "peaks.mat".
The given data is described as follows:
sig.mat: ECG signal whose size is 273010X1, which has 633 peaks as specified in "peaks.mat".
peaks.mat: the sample index where the peaks occur in "sig.mat" and the size is 633X1
So, besides upsampling the signal, how to adjust the indexes of the peaks accordingly?
Thank you,
댓글 수: 0
답변 (2개)
Star Strider
2024년 6월 23일
Use the resample function to upsample it, since this function is specifically designed for signal processing, and contains an anti-aliasing filter to prevernt spurious frequencies from appearing in the resampled signal.
댓글 수: 6
Star Strider
2024년 6월 24일
편집: Star Strider
2024년 6월 24일
My pleasure!
What do you want, then?
I’m still not clear on that.
% LD = load('dataUpsampleTime.mat')
file = websave('dataUpsampleTime.mat','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1721431/dataUpsampleTime.mat');
LD = load(file);
peaks = LD.peaks
sig = LD.sig;
tm = LD.tm;
Ts = mean(diff(tm))
% Tsd = std(diff(tm))
Fs = 1/Ts
[myPks,myLocs] = findpeaks(sig, 'MinPeakProminence',0.5)
figure
plot(tm, sig)
hold on
plot(tm(peaks), sig(peaks), 'vr')
plot(tm(myLocs), myPks, '^g')
hold off
grid
xlim([0 25])
sig_filt = highpass(sig, 1.5, Fs, 'ImpulseResponse','iir'); % Filter Out Baseline Variation
[myPks_filt,myLocs_filt] = findpeaks(sig_filt, 'MinPeakProminence',0.5);
figure
plot(tm, sig_filt)
hold on
plot(tm(peaks), sig_filt(peaks), 'vr')
plot(tm(myLocs_filt), myPks_filt, '^g')
hold off
grid
xlim([0 25])
[sig450,t450] = resample(sig_filt,tm,450)
format shortG
myLocs450 = resample(myLocs, 360,450)
myLocs450 = round(myLocs450)
[MyPks450,MyLocs450] = findpeaks(sig450, 'MinPeakProminence',0.5)
figure
plot(t450, sig450)
hold on
plot(t450(myLocs450),sig450(myLocs450), 'sr')
plot(t450(MyLocs450),sig450(MyLocs450), 'sg')
hold off
xlim([0 25])
It is simply not possible to resample the location indices as well as the signal, and have the location indices ‘make sense’ in any real way. As I mentioned earlier, find the peaks and locations of the resampled signal after resampl;ing it. Interpolating the data from the original signal to the resampled signal will simply not work. Just use findpeaks on the resampled signal and be done with it.
Notice the difference between the peak locations of the actual resampled signal and the resampled locations of the original signal. That approach just doesn’t work.
.
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!