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: Stefan Neumann
Subject: Re: Curve fitting of data from text file
Date: Wed, 24 Mar 2010 18:00:56 +0100

2010/3/24, socware <address@hidden>:

Hello,
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.

...
Any suggestion how do I proceed.?

Thanks

example for leasqr():

--- 'data.txt' with columns x1, x2 and y = f(x1,x2) ---
-0.524425 -0.417869 5.65742
0.691628 -0.695583 3.55675
0.171075 -0.613049 4.68537
0.621245 -0.652939 3.78309

--- script ---
D=load('data.txt');
x=[D(:,1),D(:,2)];
y=D(:,3);
pin=ones(1,2);   % number of parameters
F = inline('y=p(1)*x(:,1).*x(:,2)+p(2)','x','p');   # assume nl function y = a*x1*x2 + b ; find a,b
[f,p,kvg,iter,corp,covp,covr,stdresid,Z,r2]=leasqr(x,y,pin,F);




reply via email to

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