You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
This function is a combination of SLERP interpolation, with a lookup table. It interpolates the quaternions of the underlying function QUATS = F(X) at the query points XQ.
Quaternions maybe be entered as a quaternion array or a Nx4 double matrix. X and XQ must be Nx1 matrices.
MATLAB SLERP function requires knowledge of the quaternions before/after the interpolation point as well as the interpolation coefficient. These might not be evident if each quaternions are mapped to an X value.
The function uses linear interpolation to calculate the interpolation coefficient.
Example Code:
time = [10;30;50];
q1 = quaternion([-30,0,-10],'eulerd','ZYX','frame');
q2 = quaternion([-40,-30,35],'eulerd','ZYX','frame');
q3 = quaternion([-80,10,30],'eulerd','ZYX','frame');
quatsIN = [q1;q2;q3];
timeq = (11:49)';
quatsOUT = slerparray(time,quatsIN,timeq);
pts = rotatepoint(quatsIN,[1,0,0]);
newpts = rotatepoint(quatsOUT,[1,0,0]);
figure
[X,Y,Z] = sphere;
surf(X,Y,Z,'FaceColor',[0.57 0.57 0.57])
hold on;
scatter3(newpts(:,1),newpts(:,2),newpts(:,3),'filled','b')
scatter3(pts(:,1),pts(:,2),pts(:,3),'filled','r')
view(30,10)
axis equal
Cite As
Andres Morales (2026). slerparray (https://www.mathworks.com/matlabcentral/fileexchange/127813-slerparray), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.1.0 (1.76 KB)
MATLAB Release Compatibility
- Compatible with R2019b and later releases
Platform Compatibility
- Windows
- macOS
- Linux
