How do I resample my data?

3 次查看(过去 30 天)
Hi,
I am looking for a method to standardise exercise duration. I measured core temperature during 60 minutes of exercise. However, due to exhaustion not all participants were able to complete the experiment. For those participants I want to resample the data, so that all participants have an equal sample number in the exercise phase. I have tried interp1, which works. However, I want to interpolate inbetween the temperatures I measured. So that the final temperature I measured, stays the final temperature measurement.
Does anyone have suggestions?
Cheers!

采纳的回答

Image Analyst
Image Analyst 2021-1-7
If the final time point in your query x (time) vector is the same, then the final temperature will be the same. If it's not, then attach your data and code to prove otherwise.
  3 个评论
Image Analyst
Image Analyst 2021-1-7
I think you're looking for something like this, where the original data has 51 samples, but the resampled data has 60 samples, and the first and last points are the same.
s1 = load('nw2_temperature.mat')
s2 = load('nw2_time.mat')
% Get vectors from the mat files.
esophageal.nw2.Exercise.Temperature = s1.T;
times = s2.T;
% Put temperatures into a variable called "V".
V = esophageal.nw2.Exercise.Temperature;
V = V(:); % Convert to column vector.
% Get time vector starting at 0 instead of whatever they really start with.
times = times - times(1);
plot(times, V, 'b.-');
grid on;
hold on;
% Make 60 query times between 0 and the final time.
tQuery = linspace(times(1), times(end), 60);
y = interp1(times, esophageal.nw2.Exercise.Temperature, tQuery, 'spline');
plot(tQuery, y, 'r.-');
legend('V', 'y', 'location', 'north');

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by