Spline coordinates from spap2

I am trying to get third order spline approximation for a given set of points.
p=[..;..];
spline=spap2(knots,3,p(1,:),p(2,:));
This works and I can use fnplt to plot the curve. Howver, I am not sure how I can get the orthogonal coordinates.
For cscvn, fnval would return a 2D matrix of coordinates. However, it does not work here. Is there any solution to this?

4 个评论

What are the "orthogonal coordinates" ?
This was a mistake. Thank you! I am triying to find the spline coordinates using the knots as it can be done with breaks in cscvn.
Torsten
Torsten 2022-6-29
编辑:Torsten 2022-6-29
You mean the spline coefficients in the different intervals ?
Maybe you can give an example with cscvn of what you want to get.
okay. i might be getting the terms wrong. but here is what i mean with cscvn.
p=[..;..];
c=cscvn(p);
p_new=fnval(c,linspace(c.breaks(1),c.breaks(end),50));
Here, p_new would be a 2D matrix which I can use to plot and get the similar curve as p.
My idea is to use spap2 to matrix like p and get a p_new with the specific number of points ( which is from the knots as I understand) . Say P is a 2X500 matrix. I am trying to get the approximate curve with the a lower number of points using the approximation.

请先登录,再进行评论。

 采纳的回答

x = -2:.2:2;
y=-1:.25:1;
[xx, yy] = ndgrid(x,y);
z = exp(-(xx.^2+yy.^2));
sp = spap2({augknt([-2:2],3),2},[3 4],{x,y},z);
xyq = [1.8;0];
value = fnval(sp,xyq)
value = 0.0178
exp(-xyq.'*xyq)
ans = 0.0392

2 个评论

I understand your solution. Here is what I was trying to do:
p = [..;..];
p1=spap2(40,3,p(1,:),p(2,:)); %for 40 knots and third order approximation
x=p1.knots.
y=fnval(p1,p1.knots)
p_approx = [x;y];
I just wanted to get p_approx for further steps. But, can you help me understand what the coefficients are in the structure?
p1.coefs
give you the coefficients of the B-spline. My guess is that these are the coefficients a_ij in the representation of the spline
s(x,y) = sum_i sum_j a_ij * B_i(x) * B_j(y)
But you should read the documentation if this is correct.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Spline Postprocessing 的更多信息

产品

版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by