From: Juliana Salomao on 2 Aug 2010 20:33 Dear all, I am trying to construct a 3d spline (x,y)=z but the value of the splined z cannot go above 1 and below 0, but it can have the values 0 and 1. I am currently using the interp2(r,a',q0_1(:,:,k),x(2),x(1)','cubic') function, however, after checking my results, it is giving values for the output below 0. I need to get a function that is also C2. Does anyone suggest a solution? Is there a transformation I could be doing? I really appreciate the help! Juliana
From: John D'Errico on 2 Aug 2010 23:48 "Juliana Salomao" <jsalomao(a)stanford.edu> wrote in message <i37o5a$dm9$1(a)fred.mathworks.com>... > Dear all, > > I am trying to construct a 3d spline (x,y)=z but the value of the splined z cannot go above 1 and below 0, but it can have the values 0 and 1. I am currently using the interp2(r,a',q0_1(:,:,k),x(2),x(1)','cubic') function, however, after checking my results, it is giving values for the output below 0. I need to get a function that is also C2. > > Does anyone suggest a solution? Is there a transformation I could be doing? No, there is no trivial solution. Ensuring a constrained C2 solution is difficult. Even were you to use a tensor product version of pchip, it would only be C1. There are other forms of interpolating splines that can be forced to be bound constrained, but they are usually difficult to be also C2. Transformations have problems. You could do a transformation IF one and zero were never achieved, using for example, erf and erfinv as the underlying transformation. But such a transformation will have problems when the bounds are achieved. John
From: jsalomao on 3 Aug 2010 15:00 On Aug 2, 8:48 pm, "John D'Errico" <woodch...(a)rochester.rr.com> wrote: > "Juliana Salomao" <jsalo...(a)stanford.edu> wrote in message <i37o5a$dm...(a)fred.mathworks.com>... > > Dear all, > > > I am trying to construct a 3d spline (x,y)=z but the value of the splined z cannot go above 1 and below 0, but it can have the values 0 and 1. I am currently using the interp2(r,a',q0_1(:,:,k),x(2),x(1)','cubic') function, however, after checking my results, it is giving values for the output below 0. I need to get a function that is also C2. > > > Does anyone suggest a solution? Is there a transformation I could be doing? > > No, there is no trivial solution. Ensuring a constrained > C2 solution is difficult. Even were you to use a tensor > product version of pchip, it would only be C1. There > are other forms of interpolating splines that can be > forced to be bound constrained, but they are usually > difficult to be also C2. > > Transformations have problems. You could do a > transformation IF one and zero were never achieved, > using for example, erf and erfinv as the underlying > transformation. But such a transformation will have > problems when the bounds are achieved. > > John Thanks John! Do you know about a interpolation function that is 3d (x,y)=z with shape preserving? I am doing a minimization with the splined function, so I guess I could use another optimization tha does not use the hessian, or needs the function to be C2....The interp2 does not have pchip does it? Is the cubic method shape preserving? How does the tensor product thing works? Thank you soooo much for the help! It is great to have someone to ask !!! Juliana
From: John D'Errico on 3 Aug 2010 15:42 jsalomao <jsalomao7(a)gmail.com> wrote in message <f396b498-1c35-4023-8b79-a440891cc24f(a)f20g2000pro.googlegroups.com>... > On Aug 2, 8:48 pm, "John D'Errico" <woodch...(a)rochester.rr.com> wrote: > > "Juliana Salomao" <jsalo...(a)stanford.edu> wrote in message <i37o5a$dm...(a)fred.mathworks.com>... > > > Dear all, > > > > > I am trying to construct a 3d spline (x,y)=z but the value of the splined z cannot go above 1 and below 0, but it can have the values 0 and 1. I am currently using the interp2(r,a',q0_1(:,:,k),x(2),x(1)','cubic') function, however, after checking my results, it is giving values for the output below 0. I need to get a function that is also C2. > > > > > Does anyone suggest a solution? Is there a transformation I could be doing? > > > > No, there is no trivial solution. Ensuring a constrained > > C2 solution is difficult. Even were you to use a tensor > > product version of pchip, it would only be C1. There > > are other forms of interpolating splines that can be > > forced to be bound constrained, but they are usually > > difficult to be also C2. > > > > Transformations have problems. You could do a > > transformation IF one and zero were never achieved, > > using for example, erf and erfinv as the underlying > > transformation. But such a transformation will have > > problems when the bounds are achieved. > > > > John > > Thanks John! > Do you know about a interpolation function that is 3d (x,y)=z with > shape preserving? There was a shape preserving variant of pchip for n-dimensions that I recall. Written in Fortran of course. It was not C2, but I think I recall a tweak made to it so that it was properly shape preserving. You might be able to find it on netlib. Even tensor product linear interpolants are not really linear, and arguably not even completely shape preserving if you look at the interpolant along an arbitrary direction that is not aligned with the axes. > I am doing a minimization with the splined function, > so I guess I could use another optimization tha does not use the > hessian, or needs the function to be C2....The interp2 does not have > pchip does it? No. pchip is not an option, nor is pchip C2. > Is the cubic method shape preserving? The cubic method for interp2 is not shape preserving, nor if I recall properly, is it even necessarily C2. I may be wrong on this last point though. > How does the tensor product thing works? You might start here: http://en.wikipedia.org/wiki/Tricubic_interpolation http://en.wikipedia.org/wiki/Multivariate_interpolation although IMHO these descriptions are not terribly good. This next one seems a bit more descriptive: http://en.wikipedia.org/wiki/Bilinear_interpolation John
|
Pages: 1 Prev: Bar graph - groups & stacked Next: Image rotation detection probelm |