help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Curve fitting of data from text file


From: Przemek Klosowski
Subject: Re: Curve fitting of data from text file
Date: Wed, 24 Mar 2010 10:51:53 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Thunderbird/3.0.3

On 03/24/2010 10:38 AM, socware wrote:

I want to do curve fitting and get the value of the coefficients which gives
me minimum error for the equation:

I_d=a*(V_g-b)^2   %the value of I_d and V_g I get from the two columns of a
text file. I have around 2000 values of I_d&  V_g, basically trying to fit
the data from transistor I-V curve.

I have a pseudo code which will give an idea what I want to do.

i,j=0
V_g= data from 2nd column of text file
I_d= data from 1st column of text file
for a=a0/10 to a0*10                # the value of a0 can be between some
range like 100 to 10000
   i=i+1
   for b=b0/10 to b0*10              # the value of b0 can be between some
range like 30 to 3000
     j=j+1
     I_dfit(1:size(V_g))=a*(V_g-b)^2     # functione to get best fit? if
polyfit then how do I implement here.
     error(i,j)=sum( (I_fit(1:size(V_g))-I_d(1:size(V_g)))^2 )
   end
end
bestIandJ=findminimum(error)



Any suggestion how do I proceed.?

Thanks

leasqr(V_g,I_d,[1 1],@(x,p)(p(1).*(x-p(2)).^2))

might give you an approximation; [1 1] is the
initial guess for a and b.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]