comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL's function SFIT coefficients
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL's function SFIT coefficients [message #88063 is a reply to message #88062] Mon, 17 March 2014 10:12 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Monday, March 17, 2014 12:36:03 PM UTC-4, George wrote:
> The problem: I have a 2d array of data that I would like to fit using SFIT. The values returned from SFIT match the data quite well (just eyeing it for now), but when I use the coefficients to reproduce the function, I get nonsense. The IDL help file says if the polynomial is 2nd order and max_degree is used then the coeffs are returned in an vector that looks like this: [k, y, y2, x, xy, x2]. Below is a block of code that shows how I used the coefficients to calculate my surface fit (s_fit).
>
>
>
> x = [1.,2.,3.,4.,5.,6.,7.,8.,9.]
>
> y=[100.,200.,300.,500.,1000.,2000.,3000.,5000.,10000.]
>
> result = sfit(amp,2,kx=coeff,/max_degree) ;******amp is my 2d data array
...
> FOR kk=0,n_elements(x)-1 DO BEGIN s_fit[kk,ii]=coeff[0]+coeff[3]*x(kk)+coeff[1]*y(ii)+coeff[5] *x(kk)*x(kk)+coeff[4]*x(kk)*y(ii)+coeff[2]*y(ii)*y(ii)

By default, SFIT assumes that X and Y are regularly sampled. Your Y values are not regularly sampled. I guess you need to use the /IRREGULAR keyword for that.

Craig
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: adding legend to overlapping cghistoplot histograms
Next Topic: IDL program runs faster on slower CPU

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:11:09 PDT 2025

Total time taken to generate the page: 0.00456 seconds