How to upsample an ECG signal and its associated data?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Star Strider
el 23 de Jun. de 2024
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 comentarios
Star Strider
el 24 de Jun. de 2024
Editada: Star Strider
el 24 de Jun. de 2024
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.
.
Ver también
Categorías
Más información sobre Multirate Signal Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!