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 #88065 is a reply to message #88063] Mon, 17 March 2014 10:48 Go to previous message
George[1] is currently offline  George[1]
Messages: 2
Registered: March 2014
Junior Member
On Monday, March 17, 2014 12:12:33 PM UTC-5, Craig Markwardt wrote:
> 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

Perfect! I misunderstood the meaning of /IRREGULAR, but when I read your post it "clicked." Thank you very much Craig.

On a side note, I should also say thank you for your MPFIT routines -- they've been a big help in other analyses.

Regards,
George
[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 19:28:44 PDT 2025

Total time taken to generate the page: 0.00454 seconds