f

#### least square fitting

```dear Gnuplot users,

I am using the following command to fit a set of data:

f(x)=a*x+b;
fit f(x) 'dataset' via a,b

then I get the value of a and b with only one decimal digit like a=0.1,
b=0.9

how can I get five decimal digits like a=0.00001, b=0.91112 ?

Thanks

``` 0  David
7/8/2005 4:05:03 PM comp.graphics.apps.gnuplot  5008 articles. 0 followers. 6 Replies 686 Views Similar Articles

[PageSpeed] 32

```David <dagao@exchange.uta.edu> wrote:
> dear Gnuplot users,

> I am using the following command to fit a set of data:

> f(x)=a*x+b;
> fit f(x) 'dataset' via a,b

> then I get the value of a and b with only one decimal digit like a=0.1,
> b=0.9

"get the value" --- where?  All the outputs of 'fit' I'm aware of print
with a good deal more than 1 significant digit.  Well, unless all the
others following it *are* exactly zero, that is.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
``` 0  Hans
7/8/2005 4:32:07 PM
```Below is the copy:
Final set of parameters            Asymptotic Standard Error
=======================            ==========================

a               = 0.0751221        +/- 0.005317     (7.078%)
b               = -29512.8         +/- 0.001603     (5.432e-06%)

correlation matrix of the fit parameters:

a      b
a               1.000
b              -0.905  1.000

you can notice b= -29512.8 only has one decimal value.
How to change it to have more than 1 decimal digit?
Thanks

``` 0  David
7/8/2005 4:53:15 PM
```David <dagao@exchange.uta.edu> wrote:
> Below is the copy:
> Final set of parameters            Asymptotic Standard Error
> =======================            ==========================

> a               = 0.0751221        +/- 0.005317     (7.078%)
> b               = -29512.8         +/- 0.001603     (5.432e-06%)

> correlation matrix of the fit parameters:

>                a      b
> a               1.000
> b              -0.905  1.000

> you can notice b= -29512.8 only has one decimal value.

Actually the printed value has 6 significant digits.  If that's not
enough, just do a

print b

after completing the fit, and it'll show you more digits than you can
use.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
``` 0  Hans
7/8/2005 5:14:44 PM
```Thanks a lot !

Hans-Bernhard Broeker wrote:
> David <dagao@exchange.uta.edu> wrote:
> > Below is the copy:
> > Final set of parameters            Asymptotic Standard Error
> > =======================            ==========================
>
> > a               = 0.0751221        +/- 0.005317     (7.078%)
> > b               = -29512.8         +/- 0.001603     (5.432e-06%)
>
>
> > correlation matrix of the fit parameters:
>
> >                a      b
> > a               1.000
> > b              -0.905  1.000
>
> > you can notice b= -29512.8 only has one decimal value.
>
> Actually the printed value has 6 significant digits.  If that's not
> enough, just do a
>
> 	print b
>
> after completing the fit, and it'll show you more digits than you can
> use.
>
> --
> Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
> Even if all the snow were burnt, ashes would remain.

``` 0  David
7/8/2005 6:04:06 PM
```Thanks.

I checked help fit, it said it is using  Marquardt-Levenberg algorithm.

Could you please tell me the reference paper for the
Marquardt-Levenberg algorithm ?

Thanks again.

Hans-Bernhard Broeker wrote:
> David <dagao@exchange.uta.edu> wrote:
> > Below is the copy:
> > Final set of parameters            Asymptotic Standard Error
> > =======================            ==========================
>
> > a               = 0.0751221        +/- 0.005317     (7.078%)
> > b               = -29512.8         +/- 0.001603     (5.432e-06%)
>
>
> > correlation matrix of the fit parameters:
>
> >                a      b
> > a               1.000
> > b              -0.905  1.000
>
> > you can notice b= -29512.8 only has one decimal value.
>
> Actually the printed value has 6 significant digits.  If that's not
> enough, just do a
>
> 	print b
>
> after completing the fit, and it'll show you more digits than you can
> use.
>
> --
> Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
> Even if all the snow were burnt, ashes would remain.

``` 0  David
7/8/2005 6:08:42 PM
```David <dagao@exchange.uta.edu> wrote:
> Could you please tell me the reference paper for the
> Marquardt-Levenberg algorithm ?

K. Levenberg. A Method for the Solution of Certain Non-linear Problems
in Least Squares. Quarterly of Applied Mathematics, 2(2):164-168, Jul
1944

Marquardt, D.W.: An algorithm for least-squares estimation of
nonlinear parameters, SIAM Journal of Applied Mathematics
11(2):431-441, Jun 1963

OTOH, any decent textbook on numerical maths should have an
explanation of this algorithm for you.  My actual reference for the
implementation was not the paper, but H.R.Schwarz' textbook on
numerical maths (in German).

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
``` 0  Hans
7/10/2005 2:07:21 PM Similar Artilces:

Least-squares fitting a square pulse
I am trying to fit a square pulse to data in the least-squares sense in Matlab. The parameters that are being optimized are the height, start, and end - x(1), x(2) and x(3) in the program, respectively. However, the least-squares program is only varying the height, for some reason. Why is this occurring? How else could I fit a square pulse using least-squares? Although in this example the pulse would be easy to fit by inspection, for the purpose of my project, it is not an option. Code: %FITTING xdata=0:0.1:10; ydata=-.05+.1*rand(1,numel(xdata))+heaviside1(xdata-1)-heaviside1(xdata-4);...

Adding constraints to linear fit parameters of separable least squares fit
I was wondering if anyone can help me to figure out how to add equality and inequality constraints to the linear parts of a separable least squares fit. I saw fminspleas is able to do it for the nonlinear fit parameters (using transformations from a constrained problem to an unconstrained one), but not for the linear fit parameters. Here is my code for the separable least squares fit. Thanks. function[NLP,LP,res]=seplstsq(funlist,start_point,xdata,ydata,options) function [sse,LP,res]=seplstsq_sse(NLP) DM=zeros(length(ydata),length(funlist)); for ii=1:length(funlist); f...

Least square fitting
Hi, I have this graph: x = [0.000235 0.00025 0.0003 0.0004 0.0005 0.0006 0.00075] y = [54.9 43.1 62.7 86.3 86.3 90.2 96.1] plot (x, y) xlabel ('Amplitude') ylabel ('Correct Detection [%]') legend ('Psychometric Function') and I want to fit it to this equation: P(A, 'theta') = [1/sqrt(2*pi*sigma²)] * integral e^-[(A-'theta'²)/2*sigma²] how can i do this? thank you. "xety89 " <sow.chan@warwick.ac.uk> wrote in message <hqouqh\$snf\$1@fred.mathworks.com>... > Hi, > > I have this graph...

Least squares fitting
Hello everybody, I am working on an inverse problem where I need to use least squares fitting. I am working on characterization of impedance of a piezoelectric crystal. A PZT crystal can be modeled as a series RLC circuit in parallel with a parasitic capacitor. Thus, I can derive the transfer function of its impedance and admittance and simulate it (see the code below) I am trying to extract R,L,C and C0 parameters from this simulated admittance curves using least squares fitting method.( Also, I need to inversely calculate these from the admittance curves that are constructed using ...

Least Square Fit
I tried to use lsqlin to do a least square fit with 3 constraints. I had 7 variables. However it didn't seem to take into account the last 2 cosntraints. I am trying to use fmincon but keep getting an error 'Inner matrix dimensions must agree'- I checked the dimensions of the constraint and Obj function matrices.but Ican't figure out why this is happening. Help! In article <eee31fe.-1@webx.raydaftYaTP>, "Shar P" <sprabhu@ieor.berkeley.edu> writes: >I tried to use lsqlin to do a least square fit with 3 constraints. I >had 7 variables. However it ...

least square fit
I have the following data file: http://www.cs.kuleuven.ac.be/~bartv/gnuplot/sobol.dat Now I want to do a least square fit on the data of the first and second column. The data in the first-column represent the x-values, the data in the second column represent the y-values. I don't need the rest of the columns. Now I now that x and y are related somehow as: y = a/(x**b) and I want to find a and b as accurate as possible. The file that plots my data to an .eps file is at http://www.cs.kuleuven.ac.be/~bartv/gnuplot/relative_error.pl If I don't specify an initial value for b_sob, the fit fails. If I do specify a starting value of 0.9 the fit works, but the result is not satisfying as can be seen from the .eps file at http://www.cs.kuleuven.ac.be/~bartv/gnuplot/relative_error.eps I have also tried to fit on log(\$2)=a-b*log(\$1) and then plot exp(a)/(x**b) but this didn't give me satisfying results either. How can I increase the quality of my fit? Regards, Bart -- "Share what you know. Learn what you don't." Bart Vandewoestyne wrote: > I have the following data file: > > http://www.cs.kuleuven.ac.be/~bartv/gnuplot/sobol.dat > > Now I want to do a least square fit on the data of the first and > second column. The data in the first-column represent the x-values, the > data in the second column represent the y-values. I don't need the rest > of the columns. > &...

least square fit
Hi I have many file with extension (.dat). I need to open them in IDL and have least square fit. Is any one have idea on who to that. omerphysics@gmail.com writes: > I have many file with extension (.dat). I need to open them in IDL and > have least square fit. > Is any one have idea on who to that. Well, rest assured, the code will be less than 10 lines long. But, *which* 10 lines will depend on more details. What do you know about this problem? You can find a lot of hints at the web page below. Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote'...

Least square fitting
Hi all, I have a problem with a rather complicated function depending on four parameters which I try to find using least square fitting and I don't know exactly how to do it. The basic problem is the following: I have an astronomical image of a star field and try to relate the sky coordinates (right ascension, declination) of the stars to the pixel coordinates (x, y). The function to relate the two depends on the not accurately known parameters focal length of the lens (f), the rotation of the field of view with respect of the north direction (beta) and the center sky coordinates of the...

least squares fit
I'm trying to solve a system of 5+ equations for 3 unknowns, preferably using the least-squares method. I've Solve[] will not return solutions for more equations than you have unknowns. Fit[] does not work because my equations have 4 sets of data. Si=a*Ui + b*Vi + c*Wi, where i goes from 1 to 5 U, V, and W all come from a table, and S is from experimental data. I need to know how to solve for a,b,c given more than 3 equations. Background: The problem is actually trying to solve for Judd-Ofelt parameters of a laser crystal. S is the experimental line strength and U, V...

least square fit #4
I tried to fit data to get the sig and mean parameters of the gaussian distribution. I found lsqcurvefit can only get the correct fitting result of sig but not for the mean. The mean is always the initial value you set for the fitting. Any input is highly appreciated. TG My code is very simple. Is there something wrong with it? -------------------- function rst=fit_test() % % % xdata=1:1000; meandata=400; sigdata=50; ydata=gaussmf(xdata,[sigdata, meandata]); a=figure; hold on; plot(xdata,ydata) x0=[100,10]; lb=[1,1]; ub=[1000, 1000]; options=optimset('MaxFunEvals',1000,'MaxIter&...

Least squares fit with matrices
Hi, I have equation: X=a_1*Y_1+a_2*Y_2+a_3*Y_3... where size(Y_n)=size(X)=[100 100] and size(a_n)=[1 1] X and Y_n are constants How can I do some kind of least squares fit to determine a_n? -Jonne Jonne wrote: > > > Hi, > > I have equation: > > X=a_1*Y_1+a_2*Y_2+a_3*Y_3... > > where size(Y_n)=size(X)=[100 100] and size(a_n)=[1 1] > X and Y_n are constants > > How can I do some kind of least squares fit to determine a_n? > > -Jonne A = [Y1(:),Y2(:),Y3(:)]\X(:); HTH, John ...

Least squares fitting #2
I need to find the coefficients k1-k6 of the following equation: P = G*(k1 + k2*T + k3*log(G) + k4*(log(G)).^2 + k5*T*log(G)+ k6*T*(log(G)).^2+k7*T.^2); The experimental data I have are P, G and T. Is there any MATLAB function in order to obtain the coefficients using least-squares fitting? Do I need the Curve Fitting Toolbox? Thank you very much, Zaira "Zaira " <Zaira.Girbau-Garcia@jrc.it> wrote in message <g0ccfp\$jd9\$1@fred.mathworks.com>... > I need to find the coefficients k1-k6 of the following equation: > > P = G*(k1 + k2*T + ...

Least square plane fitting
Hello, i'm a student of University of Parma (Italy), and i've the following problem. I've found in internet the following model for fitting a plane from a cloud of point 3D. The link to the page is [ http://www.bmm.icnet.uk/people/suhail/plane.html ]. I've implemented this model in C++ and i've obtained some good result but when i try to reconstruct the passages of the procedure i'm not able to obtain the resulting matrix 3x3 denoted as W in the follow. I want to know if something one can help me to resolve this problem. I've tried to contact the author of the mod...

Least Squares Fitting #3
I am in need of some help. I am fitting Gaussian curves using the curve fitting toolbox. Once I fit the curve I get a x_0 centroid and a width. My goal is to fit the centroids of five different curves. I would like to fit the following and generate a slope and intercept. I am unable to do this is MATLAB. x y upper_y lower_y ..511 108 109.4 107.3 1.275 280 283 280 .... ..... ..... ..... .... ..... ..... so on and so ...

Weight least square fit
Hi everyone. A quick description of my problem: I have 4 sensor measurements (x_sensor), which can be estimated using a numerical model (nb the model is nonlinear is solved numerically...) I wish to fit the parameters of my model to best represent the measured data by performing a weighted least square fit with a different weighting for each sensor (due to different noise in the measurements). i.e. an objective function: error = A(x1_sensor - x1_model) + B(x2_sensor - x2_model) + C(x3_sensor - x3_model) + D(x4_sensor - x4_model) I am currently using lsqcurvefit but get a bad fit due to so...

Which is the fastest least squared fit?
I have a program that fits measured data to a function with a least squares fit. The measured data contains about 30 data points, and the fitting function has 5 parameters in total: y(x) = c1 * cos(c2*x + c3) * sin(c4*x)/x * exp(- c5*x) I also want to apply boundaries to the constants. I have tried several fitting algorithms, e.g. fminsearch and lsqnonlin. The trouble is, that since the fit is performed several thousands of times each time the program is executed, it is important that the function provides a fast fit. I have discovered that lsqnonlin is faster than fminsearch, but execution ...

Least Squares Surface Fitting
Dear all, I'm a beginner of Matlab using. I have to find out how to fit a surface of 2 dimensional scatterd data in a least squares sense. Are there alreay toolboxes or functions to provide that? Can anybody help and give me more information? Thankx a lot Lukas Lukas wrote: > > > Dear all, > > I'm a beginner of Matlab using. > I have to find out how to fit a surface of 2 dimensional scatterd > data in a least squares sense. > > Are there alreay toolboxes or functions to provide that? > Can anybody help and give me more information? > > Thankx a l...

Least square curve fitting
Hi all, I need some help with a curve fitting problem for data points. I have a set of data points g=[g1 g2 g3 g4 g5] h=[h1 h2 h3 h4 h5] and would like to fit these data to an equation y=ax/(b+x) in least square sense, with initial guesses a=170 and b = 1000 until R2 correlation is 95%. Thank you bubbub "Alison " <ucbeata@ucl.ac.uk> wrote in message <fhvlcg\$d1g\$1@fred.mathworks.com>... > Hi all, > > > I need some help with a curve fitting problem for data points. > > I have a set of data points > g=[g1 g2 g3 g4 g5] > h=[h1 h2 h3 h4 h...

least-squares fit with constraint
Hi, Is there a way in Matlab to perform a least-squares fit on a column vector, with the constraint that the slope is zero? I have a column vector of periods extracted from an periodic waveform, and I'm trying to find the average period, where "average period" is defined as that period having the best least-squares fit. If I run p=polyfit(x,y,1), it will return a line having a slope (albeit a small slope). Anyway to do something similar but constrain the LSF operation that the slope must be zero? Thanks in advance On Thu, 2 Dec 2010 01:28:05 +0000 (UTC), "gkk gk...

nonlinear least squares fit
Hi, I am trying to solve an optimization problem in Matlab. It is a nonlinear least squares problem. The goal is to derive the best-fit equations of seven straight lines (and other standard output e.g. residuals etc.). I've posted the problem description, and two images, one that describes the problem setting in detail, the other showing the set of 3D points I plotted for this, all here:: http://sites.google.com/site/niazarifin/matlab-project-images Since I never used any optimizer before, I'd truly appreciate if you can help on: 1.which Matlab function to use for the problem 2.what f...

Nonlinear least squares fitting
Hi, I was wondering if it is possible to use lsqcurvefit to fit input data given multiple observables? That is, if I have two observables, y1 and y2, each effected differently by input variables x1, x2 and x3, can I use lsqcurvefit to obtain values for x1, x2, and x3? Thanks Ron Ron wrote: > > > Hi, > > I was wondering if it is possible to use lsqcurvefit to fit input > data given multiple observables? That is, if I have two > observables, > y1 and y2, each effected differently by input variables x1, x2 and > x3, can I use lsqcurvefit to obtain values for x1, x2, ...

Least square surface fitting
Hi all, I'm new to Matlab I need to fit a surface to my observed data in order to find a polynomial equation of the surface. I have (x,y,z) data. Can anyone help me on this. Regards "Hashika " <hashikahimal@gmail.com> wrote in message <g5rn9d\$kne\$1@fred.mathworks.com>... > Hi all, > > I'm new to Matlab > > I need to fit a surface to my observed data in order to > find a polynomial equation of the surface. > > I have (x,y,z) data. > > Can anyone help me on this. > > Regards polyfitn, from the file exchange. http:/...

least squares curve fit
Hi I'm trying to write a program that takes data points and solves for coefficients for a least squares curve fit using matrices and starting from an initial condition. I tried building the coefficient matrix and solving for the coefficients but I end up with a straight line. Any advice would be appreciated. In article <eeed0b8.-1@webx.raydaftYaTP>, "John Roth" <jrothml@yahoo.com> writes: >Hi I'm trying to write a program that takes data points and solves >for coefficients for a least squares curve fit using matrices and which type of curve ? which type...

NonLinear least square fit
Iam using the lsqcurvefit function to estimate some parameters by fitting a kinetic model to experimental data.I need to get an estimate of the errors for the individual parameters that are calculated by the program.The function lsqcurvefit returns residuals but does not provide any estimates for the standard deviations for the parameters calculated.Iam sure there is a way of calculating them.Can someone please help? Thanks. Farah Bardai wrote: > > > Iam using the lsqcurvefit function to estimate some parameters by > fitting a kinetic model to experimental data.I need to get an &g... Web resources about - least square fitting - comp.graphics.apps.gnuplot YouTube - Jackie Brown (7/12) Movie CLIP - Fitting Room Exchange (1997) HD
Hochgeladen am 27.09.2011 Jackie Brown Movie Clip - watch all clips http://j.mp/Awgue0 click to subscribe http://j.mp/sNDUs5 Jackie (Pam Grier) ... Football fever just a game of fitting in
Were you up early cheering the Socceroos on? You may not be a football fanatic, just trying to fit in, according to a Canberra sports psychologist. ... Geminids meteor shower to provide a fitting end to International Year of Light
This year's Geminids meteor shower should provide a fittingly spectacular finale to the International Year of Light with an estimated 150 meteors ...

Resources last updated: 3/2/2016 8:31:02 PM