Re: Which Scilab curve fitting approach is most applicable.



Tim Wescott wrote:
pnachtwey wrote:

On Nov 12, 1:48 pm, Richard Owlett <rowl...@xxxxxxxxxxxxx> wrote:

Tim Wescott wrote:

Richard Owlett wrote:

Ultimate Goal:
Get a feel for pitfalls associated with changing sample rate.
Immediate Goal:
Create an artificial test signal which I intuitively understand.
Starting point:
Audio CD of text being read. It was originally recorded for cassette
tape distribution circa 1974. Identical Material later distributed on
CD. Assume from looking at FFT that original was likely low pass
limited at 8-10 kHz.
I've had glancing contact with using splines to do curve fitting. I
would like to use an algorithm which forces the fit to pass thru the
"known" points. I would then "sample" at 4 - 16 times the current 44.1
kHz.
Suggestions?

Splines are probably the right choice if you must pass through known
points, and Scilab provides spline functions.

Thanks for attempting to reply. My question evidently not phrased well.

Doing "help spline" in Scilab gives 10 hits - 5 apparently not relevant
as being 3 dimensional. I find the descriptive information on the others
to be excessively terse. And the examples don't give hints as which
functions are suitable for which problems.

Part of my problem is that I'm weak in math theory, so I'm looking for
something approaching a cookbook solution.



If I'm not mistaken a spline on data that's evenly spaced ends up being
a linear transformation

Not sure what "linear transformation" means in context. I would take it
as the math that describes a 2-port LTI network to which linear
superposition applies.

-- if the spline function in Scilab takes a
prohibitively long time you may be able to speed things up by
calculating & running the correct polyphase filter.

I've got LOTS of time and insignificant understanding of digital filters
- polyphase or not ;/ In fact upsampling by stuffing in 0's is so
counterintuitive to lead me to funny farm.- Hide quoted text -

- Show quoted text -



Do you just need to do cubic interpolation do you need to have smooth
derivatives at the knots? A cubic interpolation between 4 points is
easy. A cubic spline that makes sure the the first derivative is
smooth at knots and the second derivative is continuous. Splines may
be a liitle more that what you really need. They require solving a
system of equations. One for every point. I don't think that is
practical for music.

Ahhh. But I had stated I was working with someone reading text. None of the problems associated wide wide variation of pitch and/or source(s).


Cubic interpolation using 4 points is MUCH
easier.

Peter Nachtwey


A spline is certainly overkill. But Pentiums and math packages make overkill easy:

and *FAST* ;}


ptd = 0:10; ptd = [ptd; sin(ptd)]; // make a 'signal' to smooth
pt = smooth(ptd, 0.05); // smooth it with splines
clf; // clear the current figure
plot2d(ptd(1,:), ptd(2,:)); // plot the 'jaggy' signal
plot2d(pt(1,:), pt(2,:), style = 2); // plot the smoothed signal


I had tried smooth() before. *APPARENTLY* unsuccessfully. I was wrong. It not only had worked, but had done exactly what I was trying to accomplish. It was an educationally worthwhile "failure" :>

The key was that the CD sampling rate was high enough compared to the signal's highest frequencies that I had had to use very high magnification to observe the difference between the raw data and the smoothed data. Tim's sample code was a better match for my problem than the sample in Scilab's Help system. Thank you.

.



Relevant Pages

  • Re: csaps vs. smooth from PGS
    ... The function 'smooth' is a smoothing spline function in which a cubic curve is ... However the fortran code "smooth" doesn't allow you to specify this weighting ... The MATLAB Spline Toolbox contains a function called csaps. ...
    (comp.soft-sys.matlab)
  • Re: Function and derivative interpolation
    ... This solves my problems with the derivatives. ... approximations is what they mean implicitly. ... Also, higher order finite difference ... spline model is a global construction. ...
    (comp.soft-sys.matlab)
  • Re: How to calculate numerical derivative robustly
    ... easily be dominated by the noise. ... Thanks for your reply and spline can help when dealing with error ... the spline will not as smooth as I want. ... What you seem to be looking for is a higher order backward finite ...
    (comp.soft-sys.matlab)
  • csaps vs. smooth from PGS
    ... The MATLAB Spline Toolbox contains a function called csaps. ... documentation this function is an implementation of the fortran ... SMOOTH from "A Practical Guide to Splines" by Carl de Boor. ...
    (comp.soft-sys.matlab)
  • Re: How to calculate numerical derivative robustly
    ... This is a central difference. ... easily be dominated by the noise. ... Thanks for your reply and spline can help when dealing with error ... the spline will not as smooth as I want. ...
    (comp.soft-sys.matlab)

Loading