[sorry, I have to correct myself: I didn't mean first-derivative, but second!] Hello! I need an interpolating function Y=Func(Array,X) with these characteristics: 1) Passes through the points. 2) At least the SECOND-derivative must be continuos, thus the first-derivative must be "smooth", with no abrupt, sudden changes in slope. As far as I know Catmull-Rom doesn't satisfy the 2nd point, and many other spline-like functions don't satisfy the 1st point. Ideally, a third point would be that if the array contains a repeating pattern of 0,1,0,-1 then it should produce a sinewave. It should produce a sine-like wave also if the repeating pattern is e.g. 1,-1 or 0,.707,1,.707,0,-.707,-1,-.707 Is it even mathematically possible? Should I give up? Or what should I Google for? :P PS: yes, I thought too about the Sinc() interpolation.. but how long should the window be to give decent ( = ~ 1% error ) results? Also, what kind of windowing function should I use? Probably not rectangular, I reckon. It is for generical data, not for audio or video. Generical data may mean control data for robotic arms, etc.. I know that B-spline and others are used everyday for this task, it was just an example, but anyway I'd like this function, when implemented in 2D, to e.g. produce a circle if I use 3 points (which if linearly interpolated would make a triangle); if I use 4 points (which if linearly interpolated would make a square) it should, interpolated, produce a circle too; if I use 8 points (which if linearly interpolated would make an octagon) it should, interpolated, produce again a circle, etc.. that's why I wanted the 1D case to produce sinewaves. I know, that leads me auto- magically to sinc() interpolation.. hmm. Many thanks, Mike
Correction for: Interpolating function with two important characteristics
Started by ●October 19, 2005
Reply by ●October 19, 20052005-10-19
<mike@unknown.no.spam.com> wrote in message news:4356396b$0$29558$4fafbaef@reader1.news.tin.it...><snip>> It is for generical data, not for audio or video. Generical data may > mean control data for robotic arms, etc.. I know that B-spline and > others are used everyday for this task, it was just an example, but > anyway I'd like this function, when implemented in 2D, to e.g. produce > a circle if I use 3 points (which if linearly interpolated would make > a triangle); if I use 4 points (which if linearly interpolated would > make a square) it should, interpolated, produce a circle too; if I > use 8 points (which if linearly interpolated would make an octagon) > it should, interpolated, produce again a circle, etc..http://www.mathlab.sunysb.edu/~scott/Papers/Book331/Fitting_circle.html seems a more direct method to get where you want to be : what's stopping you from finding a least squares fit to a circle when no. of points > 3 ? Best of Luck - Mike
Reply by ●October 19, 20052005-10-19
mike@unknown.no.spam.com wrote: ...> It is for generical data, not for audio or video. Generical data may > mean control data for robotic arms, etc.. I know that B-spline and > others are used everyday for this task, it was just an example, but > anyway I'd like this function, when implemented in 2D, to e.g. produce > a circle if I use 3 points (which if linearly interpolated would make > a triangle); if I use 4 points (which if linearly interpolated would > make a square) it should, interpolated, produce a circle too; if I > use 8 points (which if linearly interpolated would make an octagon) > it should, interpolated, produce again a circle, etc.. that's why I > wanted the 1D case to produce sinewaves. I know, that leads me auto- > magically to sinc() interpolation.. hmm.any three points _can_ define a circle. They can also define an infinity of parabolas depending on orientation, and many other shapes. Four points must be specially related in order to lie on the same circle. Have you thought through what you really want? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●October 19, 20052005-10-19
Mike Yarwood wrote: ...> http://www.mathlab.sunysb.edu/~scott/Papers/Book331/Fitting_circle.html > > seems a more direct method to get where you want to be : what's stopping you > from finding a least squares fit to a circle when no. of points > 3 ?A least-squares fit won't satisfy the critrerion od passing exactly through the given points. Most sets of four points don't lie on any circle. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●October 19, 20052005-10-19
in article 4356396b$0$29558$4fafbaef@reader1.news.tin.it, mike@unknown.no.spam.com at mike@unknown.no.spam.com wrote on 10/19/2005 08:17:> [sorry, I have to correct myself: I didn't mean first-derivative, > but second!] > > Hello! > I need an interpolating function Y=Func(Array,X) with these > characteristics: > > 1) Passes through the points. > 2) At least the SECOND-derivative must be continuos, thus the > first-derivative must be "smooth", with no abrupt, sudden changes > in slope. >a windowed sinc function f(x) = w(x/L)*sinc(x) = w(x/L)*sin(pi*x)/(pi*x) where an the window size, 2*L, is exactly an even integer lengths of "x" and where the window is of a quadratic nature where it is spliced to zero (the Hann window will do this: w(x/L) = 0.5*(1+cos(pi*x/L) for |x|<L), will pass through the points and satisfy the 2nd derivative continuity requirement. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●October 19, 20052005-10-19
Jerry Avins wrote:> Mike Yarwood wrote: > > ... > > > http://www.mathlab.sunysb.edu/~scott/Papers/Book331/Fitting_circle.html > > > > seems a more direct method to get where you want to be : what's stopping you > > from finding a least squares fit to a circle when no. of points > 3 ? > > A least-squares fit won't satisfy the critrerion od passing exactly > through the given points. Most sets of four points don't lie on any circle.But if you expect a circle, then the points don't lie on it due to some error function. Instead of trying to interpolate between points and hoping you get something close to a circle, why not start with a closest fit circle and then just interpolate the error function to get the desired exact match at the sample points? -- rhn A.T nicholson d.O.t C-o-M
Reply by ●October 19, 20052005-10-19
rhnlogic@yahoo.com wrote:> Jerry Avins wrote: > >>Mike Yarwood wrote: >> >> ... >> >> >>>http://www.mathlab.sunysb.edu/~scott/Papers/Book331/Fitting_circle.html >>> >>>seems a more direct method to get where you want to be : what's stopping you >>>from finding a least squares fit to a circle when no. of points > 3 ? >> >>A least-squares fit won't satisfy the critrerion od passing exactly >>through the given points. Most sets of four points don't lie on any circle. > > > But if you expect a circle, then the points don't lie on it > due to some error function. Instead of trying to interpolate > between points and hoping you get something close to a > circle, why not start with a closest fit circle and then > just interpolate the error function to get the desired exact > match at the sample points?Sure, if that's what you want. It's not in the specs, though. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●October 19, 20052005-10-19
Jerry Avins wrote:> rhnlogic@yahoo.com wrote: > > Jerry Avins wrote: > >>Mike Yarwood wrote: > >>> : what's stopping you > >>>from finding a least squares fit to a circle when no. of points > 3 ? > >> > >>A least-squares fit won't satisfy the critrerion od passing exactly > >>through the given points. Most sets of four points don't lie on any circle. > > > > But if you expect a circle, then the points don't lie on it > > due to some error function. Instead of trying to interpolate > > between points and hoping you get something close to a > > circle, why not start with a closest fit circle and then > > just interpolate the error function to get the desired exact > > match at the sample points? > > Sure, if that's what you want. It's not in the specs, though.Do you consider "ideally point 3" to be part of the spec? -- rhn
Reply by ●October 20, 20052005-10-20
rhnlogic@yahoo.com wrote:> Jerry Avins wrote: > >>rhnlogic@yahoo.com wrote: >> >>>Jerry Avins wrote: >>> >>>>Mike Yarwood wrote: >>>> >>>>>: what's stopping you >>>> >>>>>from finding a least squares fit to a circle when no. of points > 3 ? >>>> >>>>A least-squares fit won't satisfy the critrerion od passing exactly >>>>through the given points. Most sets of four points don't lie on any circle. >>> >>>But if you expect a circle, then the points don't lie on it >>>due to some error function. Instead of trying to interpolate >>>between points and hoping you get something close to a >>>circle, why not start with a closest fit circle and then >>>just interpolate the error function to get the desired exact >>>match at the sample points? >> >>Sure, if that's what you want. It's not in the specs, though. > > > Do you consider "ideally point 3" to be part of the spec?No, but "1) Passes through the points" is. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●October 20, 20052005-10-20
robert bristow-johnson wrote:> in article 4356396b$0$29558$4fafbaef@reader1.news.tin.it, > mike@unknown.no.spam.com at mike@unknown.no.spam.com wrote on 10/19/2005 > 08:17: > > > [sorry, I have to correct myself: I didn't mean first-derivative, > > but second!] > > > > Hello! > > I need an interpolating function Y=Func(Array,X) with these > > characteristics: > > > > 1) Passes through the points. > > 2) At least the SECOND-derivative must be continuos, thus the > > first-derivative must be "smooth", with no abrupt, sudden changes > > in slope. > > > > a windowed sinc function > > f(x) = w(x/L)*sinc(x) = w(x/L)*sin(pi*x)/(pi*x) > > where an the window size, 2*L, is exactly an even integer lengths of "x" and > where the window is of a quadratic nature where it is spliced to zero (the > Hann window will do this: w(x/L) = 0.5*(1+cos(pi*x/L) for |x|<L), will pass > through the points and satisfy the 2nd derivative continuity requirement.But how large will the error be with respect to the 3rd requirement, producing an exact sine wave or circle from a samples of one? -- rhn






