Interpolating linearly between many values in a vector
조회 수: 1 (최근 30일)
이전 댓글 표시
I am using a sensor which updates time information at 1Hz, but samples data at 1kHz. Therefore I have a time array like so:
t_old =
if the collect was n seconds long. I would like 999 other time stamps in between the already existing ones. So the result ought to be
t_new =
댓글 수: 0
답변 (2개)
Adam Danz
2019년 8월 14일
편집: Adam Danz
2019년 8월 16일
Set the 'resampleRate' to 1000 if you want [1,2] to become [1.001, 1.002, ... 2.999].
'timestamps' is your original vector.
resampleRate = 1000;
timestamps = 1:10; %must be a vector
timeStampsResampled = reshape((timestamps(:) + linspace(0,1-1/resampleRate,resampleRate)).',1,[]);
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!