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

Home » Public Forums » archive » Help with least squares on non-linear function
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: Help with least squares on non-linear function [message #85664 is a reply to message #85661] Sun, 25 August 2013 05:40 Go to previous message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
On Sat, 24 Aug 2013 14:53:39 -0700 (PDT), Phillip Bitzer wrote:

> Yep, that was the next piece of advice :-) MPFIT is highly recommended....

I would say, this is a linear function. Here is a way how to calculate
the fit parameters.

Put your x, k and y values into the arrays
x=dblarr(npoints)
k=dblarr(npoints)
y=dblarr(npoints)

With npars=3, create the matrix
fx=dblarr(npoints,npars)
for i=1,npars do fx[0,i-1]=((1+k)^i-k^i)*x^i

and do the calculation
temp=transpose(fx)
a=temp#fx
b=temp#y
ludc,a,indx
par=lusol(a,indx,b)

par is an array with npars elements and should contain the fit
parameters named by a_i within your function.

I hope, that there is no error in this code. I couldn't test it,
because I have no example values for x, k and y.

Cheers, Heinz
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FONT_SIZE in PLOT()
Next Topic: Does Java polymorphism not work via the IDL Java Bridge?

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

Current Time: Fri Oct 10 01:09:56 PDT 2025

Total time taken to generate the page: 0.80059 seconds