Spline coordinates from spap2

9 views (last 30 days)
Biraj Khanal
Biraj Khanal on 29 Jun 2022
Edited: Torsten on 1 Jul 2022
I am trying to get third order spline approximation for a given set of points.
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?
Biraj Khanal
Biraj Khanal on 29 Jun 2022
okay. i might be getting the terms wrong. but here is what i mean with cscvn.
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.

Sign in to comment.

Accepted Answer

Torsten on 29 Jun 2022
Edited: Torsten on 29 Jun 2022
x = -2:.2:2;
[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
ans = 0.0392
Torsten on 1 Jul 2022
Edited: Torsten on 1 Jul 2022
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.

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by