필터 지우기
필터 지우기

How do I resample my data?

조회 수: 3 (최근 30일)
Veerle Kohlen
Veerle Kohlen 2021년 1월 7일
댓글: Veerle Kohlen 2021년 1월 8일
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');
Veerle Kohlen
Veerle Kohlen 2021년 1월 8일
Thank you!

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

추가 답변 (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