MATLAB: How to increase sampling rate of PPG data using spline interpolation

interpolationresamplingspline interpolation

I have PPG (heart-rate) data that was collected using a sampling rate of 100 Hz. Before performing any analyses, I need to re-sample the data to 300 Hz using cubic spline interpolation.
The data are saved in text files in column vector format. The file I am working with now is saved as PPG001 and has been imported into my workspace.
I was able to successfully increase the sampling rate to 300 with the following code:
x = PPG001;
p = 3;
q = 1;
y = resample(x,p,q);
Because linear interpolation is set as the default, how do I add a 'spline' function to ensure that the resample function uses cubic spline interpolation?
I tried this, unsuccessfully:
x = PPG001;
t = 1:39811;
fs = 100;
p = 3
q = 1
y = resample(x,t,fs,p,q,'spline');
This is the error message I get:
Error using resample Too many input arguments.
Error in Untitled4 (line 7) y = resample(x,t,fs,3,1,'spline');
Thanks, in advance, for your help!

Best Answer

I would not resample raw EKG signals with anything other than linear interpolation. To do so risks obscuring or distorting small-amplitude deflections such as Q-waves and S-waves, and creating artefacts in the R-waves and ST-segments.
If your data are simply rates and not raw EKG, and you want to do a spline interpolation, I would use the interp1 function specifying the 'spline' method. One possibility:
x = PPG001;
t = 1:39811;
fs = 100;
t_interp = linspace(min(t), max(t), 3*length(t));
x_interp = interp1(t, x, t_interp, 'spline');
The ‘x_interp’ data should be what you want. To plot the interpolated data, use both vectors:
plot(t_interp, x_interp)
NOTE: Since I don’t have your data, this is untested code.