uniform knot vector for splines
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
Suppose we have uniform interpolation points, e.g
x = [1 2 3 4 5 6]
x = 1x6
1 2 3 4 5 6
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
The functions for knot generation produce knots of the form
t = aptknt(x,5)
t = 1x11
1.0000 1.0000 1.0000 1.0000 1.0000 3.5000 6.0000 6.0000 6.0000 6.0000 6.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
where the first and last knot is repeated k times, but the breaks are no longer uniform. Similar for other knot functions like optknt.
I would like to carry over the property of equal distance between the interp. points to the knots. The knot vector
t = 1 1 1 2 3 4 5 6 6 6 6
satisfies this, as well as the Schoenberg-Whitney conditions. I arbitrarily repeated the first knot 3 times and the last knot four times.
Is such a knot vector plausible and why does MATLAB not offer functions for uniform knot sequences?
채택된 답변
Bruno Luong
2024년 4월 12일
편집: Bruno Luong
2024년 4월 12일
Your knot sequence seems NOT to be suitable for interpolation. The interpolation matrix is singular.
x = linspace(1,6,6);
xi = linspace(min(x),max(x),61);
k = 5;
k1 = floor(k/2);
k2 = k-k1;
tSAW = [repelem(x(1),1,k1) x repelem(x(end),1,k2)]
tSAW = 1x11
1 1 1 2 3 4 5 6 6 6 6
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
t = aptknt(x,k);
for p=0:k-1
y = x.^p;
sSAW = spapi(tSAW,x,y); % Not workingn coefs are NaN
s = spapi(t,x,y);
subplot(3,2,p+1);
yiSAW = fnval(sSAW, xi);
yi = fnval(s, xi);
plot(x, y, 'ro', xi, yiSAW, 'b+', xi, yi, 'g-') % Blue curve not plotted since yiSAW are NaN
end
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.

It seems Schoenberg-Whitney conditions are violated despite what you have claimed.
댓글 수: 7
SA-W
2024년 4월 12일
Interesting. But the Schoenberg-Whitney conditions
knots(i) < x(i) < knots(i+k), i=1:length(tau)
Bruno Luong
2024년 4월 12일
편집: Bruno Luong
2024년 4월 12일
You need to revise the spline theory, or make correct logical dediction.
k = 5;
x = linspace(1,6,6);
k1 = floor(k/2);
k2 = k-k1;
tSAW = [repelem(x(1),1,k1) x repelem(x(end),1,k2)]
tSAW = 1x11
1 1 1 2 3 4 5 6 6 6 6
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
n = length(tSAW) - k;
figure
hold on
% Interpolation matrix at station x
M = zeros(n);
,for i = 1:n
si = spmak(tSAW, accumarray(i, 1, [n 1])');
fnplt(si);
M(:,i) = fnval(si,x);
end

% All basis functions is 0 at first and last knots/station
% First and last rows of M contain 0s
M
M = 6x6
0 0 0 0 0 0
0.5139 0.3194 0.0417 0 0 0
0.0556 0.4444 0.4583 0.0417 0 0
0 0.0417 0.4583 0.4444 0.0556 0
0 0 0.0417 0.3194 0.5139 0.1250
0 0 0 0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
% Singularity
cond(M)
ans = Inf
rank(M)
ans = 4
Bruno Luong
2024년 4월 13일
편집: Bruno Luong
2024년 4월 13일
This Schoenberg Whitney (SW) conditions are violated twice.
With
k = 5;
% station vector is
x = [1 2 3 4 5 6];
% Knot vector is
tSAW = [1 1 1, 2 3 4 5, 6 6 6 6];
for i = 1:
- knot(i) = tSAW(1) = 1
- tau(i) = x(1) = 1
- So knots(i) is NOT < tau(i)
for i = 6:
- knot(i+k) = tSAW(11) = 6
- tau(i) =x(6) = 6
- So tau(i) is NOT < knots(i+k)
% Small code to check SW condition
if SWtest(x, tSAW)
fprintf('Schoenberg Whitney test pass\n');
else
fprintf('Schoenberg Whitney test fails\n');
end
Schoenberg Whitney test fails
function OK = SWtest(x, t)
x = sort(x); t = sort(t);
n = length(x);
k = length(t)-n;
OK = true;
for i = 1:n
xi = x(i);
tl = t(i);
multiplicity = nnz(t == tl);
if multiplicity >= k
test_i = tl <= xi;
else
test_i = tl < xi;
end
tr = t(i+k);
multiplicity = nnz(t == tr);
if multiplicity >= k
test_i = test_i && xi <= tr;
else
test_i = test_i && xi < tr;
end
OK = OK && test_i;
end
end
Note that all the basis functions N_i,5 for i=1,2...6 are continuous since the (extreme) knots are repeats less than k=5 times in your case.
All of them vanish outside the support, meaning for x < 1 or x > 6 So all of them must = 0 at x = 0 and x = 6 (since they are C0). This violate SW original condition of N_i,5 (x(i)) must be > 0. This is nother way to prove Schoenberg Whitney conditions are violated.
That explains aslo why the interpolation matrix M has 2 null rows and is singular therefore not suitable for interpolation, and spapi won't work with such knot sequence.
SA-W
2024년 4월 13일
Thanks for your detailed answer. Just a comment:
for i = 1:
- knot(i) = tSAW(1) = 1
- tau(i) = x(1) = 1
- So knots(i) is NOT < tau(i)
for i = 6:
- knot(i+k) = tSAW(11) = 6
- tau(i) =x(6) = 6
- So tau(i) is NOT < knots(i+k)
But the conditions are also violated at i=1 and i=6 for the knots generated by aptknt(x,5). But in your code, it is clear. Also the argumentation with the rank is clear.
The fact that the basis functions are zero at x(1) and x(end) is a consequence of having x(1) and x(end) not repeated k times in the knot vector, right?
That said, there is no way to have uniform knot breaks on the interpolation domain?
Bruno Luong
2024년 4월 13일
"But the conditions are also violated at i=1 and i=6 for the knots generated by aptknt(x,5). But in your code, it is clear. Also the argumentation with the rank is clear."
Please Read carefully what ever your reference on SW theorem and conditions, the test change (non strict) when knot mulltiplicity == k as I implement in my function SWtest function.
Bruno Luong
2024년 4월 13일
편집: Bruno Luong
2024년 4월 13일
"That said, there is no way to have uniform knot breaks on the interpolation domain?"
What is the purpose of it? What if your x is non unform to start with, an assumption you never spell out.
You could chose
x = 1:6;
k = 5;
n = length(x);
dt =(max(x)-min(x))/(n-k+1);
teq = min(x) + dt*(-k+1:n)
teq = 1x11
-9.0000 -6.5000 -4.0000 -1.5000 1.0000 3.5000 6.0000 8.5000 11.0000 13.5000 16.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
OK = SWtest(x, teq)
OK = logical
1
figure
hold on
for i = 1:n
si = spmak(teq, accumarray(i, 1, [n 1])');
fnplt(si);
end
xlim([min(x) max(x)]);

or
dx = mean(diff(x));
dt = dx;
a = (n+k-1)/2;
teqx = mean(x) + dt*(-a:a)
teqx = 1x11
-1.5000 -0.5000 0.5000 1.5000 2.5000 3.5000 4.5000 5.5000 6.5000 7.5000 8.5000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
OK = SWtest(x, teqx)
OK = logical
1
figure
hold on
for i = 1:n
si = spmak(teqx, accumarray(i, 1, [n 1])');
fnplt(si);
end
xlim([min(x) max(x)]);

SA-W
2024년 4월 13일
편집: Bruno Luong
2024년 4월 13일
What is the purpose of it? What if your x is non unform to start with, an assumption you never spell out.
I know that my interpolant is barely sampled at some regions and I can circumvent this with the positioning of interpolation points x. For instance, when I do csape(x,y), the interpolation segments are determined by x, whereas for spapi and friends, the knot vector determiens the interpolation segments and I only have semi-control.
Anyway, if x is uniform, the knot vector aptknt(x,k) is uniform as well except at the boundary. So i can live with that. I was just wondering if there are alternatives and you provided some.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Breaks, Knots, and Sites에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
