uniform knot vector for splines
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Suppose we have uniform interpolation points, e.g
x = [1 2 3 4 5 6]
The functions for knot generation produce knots of the form
t = aptknt(x,5)
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?
0 Commenti
Risposta accettata
Bruno Luong
il 12 Apr 2024
Modificato: Bruno Luong
il 12 Apr 2024
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)]
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
It seems Schoenberg-Whitney conditions are violated despite what you have claimed.
7 Commenti
Bruno Luong
il 13 Apr 2024
Modificato: Bruno Luong
il 13 Apr 2024
"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)
OK = SWtest(x, teq)
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)
OK = SWtest(x, teqx)
figure
hold on
for i = 1:n
si = spmak(teqx, accumarray(i, 1, [n 1])');
fnplt(si);
end
xlim([min(x) max(x)]);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Interpolation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!