slerparray
Version 1.1.0 (1.76 KB) by
Andres Morales
This function gives SLERP the functionality of a look-up table (similar to interpolation at query points).
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 (2024). slerparray (https://www.mathworks.com/matlabcentral/fileexchange/127813-slerparray), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2023a
Compatible with R2019b and later releases
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.