Using spline or interp1 to time normalise joint angle data

2 views (last 30 days)
Hi,
I am trying to time normalise various GRF and joint data to 101 points to comeapre phases that are of unequal lengths.
I have two methods of time normalising the data however could someone please help to elabortae on which method is more correct.
Method 1:
RKneeAngle % Test data
RKneeAngleTN = interp1(1:numel(RKneeAngle), RKneeAngle, linspace(1, numel(RKneeAngle), 101)');
Method 2:
[rows, columns] = size(RKneeAngle);
SampleStep = linspace(1,rows,101);
RKneeAngleTN = zeros(101,columns);
for ii = 1:101
for mm = 1:columns
RKneeAngle(ii,mm) = spline(RKneeAngle(:,mm),SampleStep(ii));
end
end
Both methods produce very similar results however I would like to know which would be prefered in this case and possibly why.
Thanks for any clarification

Answers (1)

Daksh
Daksh on 19 Dec 2022
It is my understanding that you need clarification between interp1() and spline() methods for your application. Kindly refer to this Documentation link for "interp1()" function for 1D data interpolation, go to "methods" and you will find "spline()" method for cubic interpolation. Go through the following headings to get specific information about these methods regarding your purpose:
  • Description
  • Continuity
  • Comments
Based on just the coding format, your Method 2 seems lengthy, memory intensive as it creates variables into workspace and inconcise. Take all of these factors into consideration for your query.
Hope it helps!

Community Treasure Hunt

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

Start Hunting!