From: matlaberboy on 29 May 2010 09:23 I have a dataset, X, Y. Where X is a repetative process. eg X = 1,2,3.....n,1,2,3....n,1,2.... [mySpline, values, rho] = spaps(X, Y, splineTol); fnplt(mySpline) I see that at the extremes of the spline, the spline behaves oddly and not only that the coeff of knot=n is nowhere near teh coeff of knot=1. This is obviously wrong as it is a cyclic process and there is no rational for a "jump" on going n->1. The solution I came up with was to multiply X and Y out by m times and then spline: function xOut = replicater(x, n) lenX = n * length(x); xOut = NaN(1, lenX); k = 1; for i = 0: n-1 for j = 1: length(x) xOut(k) = (i * (x(end) - x(1))) + x(j); k = k + 1; end end end [mySpline2, values, rho] = spaps(xOut, Y, splineTol); fnplt(mySpline2) This gives m splines alltogether without the jump. great. Now I just want to cut the splines up according to the knots. However when I do this, I see I hit the problem with fnplt (as per the documentation): "Cautionary Note The basic interval for in B-form is the interval containing all the knots. This means that, e.g., is sure to vanish at the endpoints of the basic interval unless the first and the last knot are both of full multiplicity , with the order of the spline . Failure to have such full multiplicity is particularly annoying when is a spline curve, since the plot of that curve as produced by fnplt is then bound to start and finish at the origin, regardless of what the curve might otherwise do. Further, since B-splines are zero outside their support, any function in B-form is zero outside the basic interval of its form. This is very much in contrast to a function in ppform whose values outside the basic interval of the form are given by the extension of its leftmost, respectively rightmost, polynomial piece." Indeed, this is just what i see. The spline is near perfect, but at the extremes it is forced to zero. arhgg! ANY help would be massively appreciated!
From: matlaberboy on 29 May 2010 09:48 In addition to my last post: What I want to be able to do is force periodic conditions for a B-spline (or indeed any smoothing spline would do). ie for my spline I want to match first and second derivatives at left end with those at right end. I see you can do this with csape.m but it's not a smoothing spline sadly.
From: Matt J on 29 May 2010 13:56 "matlaberboy " <matlaberboy(a)gmail.NOSPAM.com> wrote in message <htr5ul$n20$1(a)fred.mathworks.com>... > In addition to my last post: > > What I want to be able to do is force periodic conditions for a B-spline (or indeed any smoothing spline would do). ie for my spline I want to match first and second derivatives at left end with those at right end. > > I see you can do this with csape.m but it's not a smoothing spline sadly. For uniform cardinal B-splines (don't know if that's your situation), you might look at this http://www.mathworks.com/matlabcentral/fileexchange/26292-regular-control-point-interpolation-matrix-with-boundary-conditions An example is given for B-spline fitting with various boundary conditions
From: matlaberboy on 30 May 2010 11:42 > For uniform cardinal B-splines (don't know if that's your situation), you might look at this > > http://www.mathworks.com/matlabcentral/fileexchange/26292-regular-control-point-interpolation-matrix-with-boundary-conditions > > An example is given for B-spline fitting with various boundary conditions ### hi matt. thanks so much for your reply. very kind. I am unclear what "uniform cardinal B-splines" are: are these what are output by spaps.m? spaps is how I am generating my B-spline. thanks!!
From: Matt J on 30 May 2010 11:58 "matlaberboy " <matlaberboy(a)gmail.NOSPAM.com> wrote in message <htu10d$jrh$1(a)fred.mathworks.com>... > ### > > hi matt. > thanks so much for your reply. very kind. > > I am unclear what "uniform cardinal B-splines" are: are these what are output by spaps.m? spaps is how I am generating my B-spline. ======= Hi, I don't have the Spline Toolbox and am not too familiar with spaps. Cardinal B-Splines are a spline basis function generated by taking the n-fold convolution of a rect function rect(x)= @(x) abs(x)<=.5 with itself. I don't think it really matters for you, since they are basis functions spanning the same space as other splines. The more important question, as far as using the FEX submission is concerned, is whether your control points are uniformly spaced. That is an underlying assumption of the interpMatrix tool.
|
Pages: 1 Prev: Conical shallow shell Next: Any examples and tutorial books on SimMechanics? |