Interpolation on sphere with curve fitting toolbox

I'd like to know if it is possible to restirct the interpolation to the unit 3-sphere using curve fitting toolbox.
I have given points on that represent a not necessarily closed curve that i want to interpolate.
% generate points
n = 10;
a = linspace(0,2*pi,n);
r = 0.5;
v1 = sin(r).*cos(a);
v2 = sin(r).*sin(a);
v3 = zeros(1,length(a));
v4 = ones(1,length(a)).*cos(r);
% vectors / points on S^3
vec = [v1;v2;v3;v4];
% interpolation
curve_s = csapi(a,vec);
vecnorm(fnval(curve_s,[0:0.1:2*pi]))
The problem is that not all vectors that are reconstructed have .
Is there a way to restrict csapi that the reconstructed vectors have length 1 (are on the surface of the unit 3-sphere) ?
Thanks in advance

 採用された回答

Matt J
Matt J 2019 年 9 月 30 日
編集済み: Matt J 2019 年 9 月 30 日

0 投票

You could pre-convert the input to spherical coordinates CART2SPH and then convert back after the interpolation.

4 件のコメント

Drazen Sander
Drazen Sander 2019 年 9 月 30 日
The points that i have represent a closed curve in R^3. The reason i project them to the sphere in 4 dimesions is that i want to do some calculation in R^4.
So i can not use you solution because i have 4 coordinates. Anyway i also dont understand how this would solve the problem ? The points between the maped one that i get from the interpolation dont need to have length 1 by changing the representation of the point. Or do i miss something ?
Matt J
Matt J 2019 年 9 月 30 日
編集済み: Matt J 2019 年 9 月 30 日
The reason i project them to the sphere in 4 dimesions is that i want to do some calculation in R^4.
This seems like a different question now from the one you posted: "I have given discrete points in R^3 that i map to S^3."
The points between the maped one that i get from the interpolation dont need to have length 1 by changing the representation of the point.
After converting to spherical coordinates, you would interpolate only the azimuthal and elevation coordinates, while leaving the radial coordinate unchanged.
Drazen Sander
Drazen Sander 2019 年 9 月 30 日
Thank you. I edited my question i hope now it is more clear whats the problem.
Matt J
Matt J 2019 年 10 月 1 日
Similar to my original suggestion, you could convert your points to 4D spherical coordinates,
and simply do the spline fit on the components.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2018b

質問済み:

2019 年 9 月 30 日

コメント済み:

2019 年 10 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by