Re: Like SPLINE but does not go through all points [message #50294] |
Tue, 26 September 2006 14:28 |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Dilkushi@gmail.com wrote:
> Dear all
> I need to plot a smooth line to go through the plotted points but not
> through all of them.. as they are noisy and we need aline through the
> good points to see trends
If all you require is a pretty picture, then maybe you want the NSUM
keyword for PLOT and OPLOT.
Cheers,
Ben
|
|
|
Re: Like SPLINE but does not go through all points [message #50309 is a reply to message #50294] |
Tue, 26 September 2006 09:17  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Dilkushi@gmail.com wrote:
> Dear all
> I need to plot a smooth line to go through the plotted points but not
> through all of them.. as they are noisy and we need aline through the
> good points to see trends
A straight line? Try LINFIT ... or any of the other myriad line/curve fitters in IDL.
Links on the IDL help page for LINFIT have the:
<quote>
See Also
COMFIT, CURVEFIT, GAUSSFIT, LADFIT, LMFIT, POLY_FIT, REGRESS, SFIT, SVDFIT
</quote>
And there's Craig Markwardt's MPFIT too.
Or, given an x and y array of n points you could do the following:
xAverage = MEAN( x )
yAverage = MEAN( y )
sum_dx2 = TOTAL( ( x - xAverage )^2 )
b = TOTAL( ( x - xAverage ) * ( y - yAverage ) ) / sum_dx2
a = yAverage - ( b * xAverage )
yCalculated = a + ( b * x )
with some fit stats:
Residual_Sum_of_Squares = TOTAL( ( y - yCalculated )^2 )
Residual_Mean_Square = Residual_Sum_of_Squares / FLOAT( n-2 )
but the IDL routines have more options (and are probably faster, etc).
paulv
--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
|
|
|
Re: Like SPLINE but does not go through all points [message #50310 is a reply to message #50309] |
Tue, 26 September 2006 09:16  |
greg michael
Messages: 163 Registered: January 2006
|
Senior Member |
|
|
Take a look at CURVEFIT. You'll need some kind of model function with
free parameters - a polynomial, perhaps.
Greg
Dilkushi@gmail.com wrote:
> Dear all
> I need to plot a smooth line to go through the plotted points but not
> through all of them.. as they are noisy and we need aline through the
> good points to see trends
> Please help
> Thanks
> dilkushi
|
|
|