best fit (least squares) of sphere
I have point cloud data that is in t,x,y,z format of a hemispherical surface. What I need to be able to do is calculate the center point and radius of the best fit sphere. Unfrotunately, I can not simple calculate the distance from a global origin.
Anyone have any suggestions?
...Re: best fit (least squares) of sphere
On Fri, 6 Mar 2009 13:57:01 +0000 (UTC), Michael wrote:
> I have point cloud data that is in t,x,y,z format of a hemispherical surface. What I need to be able to do is calculate the center point and radius of the best fit sphere. Unfrotunately, I can not simple calculate the distance from a global origin.
> Anyone have any suggestions?
Write a functional which have to be minimised in least square sense. Then
traditional methods (which rely on function derivation) can be used.
doert <email@example.com> wrote in message <csmkmmp5fbso.13dwb7jdow8xv.dlg@...get endpoints of line after least squares fitting
I have some points on an image in pixels (u,v). I fit a line through it using least squares fit.
But having trouble in determining the starting and endpoints of the line.
can you guys suggest any possible way I should go about it?
thanks a lot
I forgot to include my code so far :
function [a0 a1] =Linear_Regression(x,y)
n = length(x);
a1 = (n*sum(x.*y) - sum(x)*sum(y)) /(n*sum(x.^2)-(sum(x))^2);
a0 = mean(y) -a1*mean(x);
%-------------------------------------------------------------...help with least squares line fitting through points...
I am attempting to do a least squares fit of a line through a set of
data points (and plot the line and points), and opted to use
polyfit/polyval instead of the "\" operator. I thought this would be
rather easy, but when I use the code on the following data, the result
is not as I expected. Can anyone run the following, and point out my
error (the real code is just a couple of lines...)? Thanks.
data=[ 64.7100 56.8700
64.4...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.
ydata=-.05+.1*rand(1,numel(xdata))+heaviside1(xdata-1)-heaviside1(xdata-4);...Help with orthogonal least squares line fit with slope constraint...
If I have a group of points, I know I can do a least-squares line fit
in the orthogonal sense by doing an eigenvector-type approach. The
code I've been using for this is:
Xm = mean(X);
A = cov(X);
[V,D] = eig(A);
[ignore,imx] = max(diag(D)); % Choose eigenvector with max.
x = Xm + V(:,imx)'*t;
x2 = Xm + V(:,imx)'*t;
Now, I am looking to do a best fit line through the data, again in an
(orthogonal) least-squares sense, but this time where the s...Best fit line for an exponential line
I am new to using GNUPLOT and am trying to find the best fit line (to
determine the slope) of a line that follows Power Law (is an
exponential line). I realize I have to use a function f(x) = a*b**x.
But, I do not know what to do next. Any help in this matter would be
Divya Rao <firstname.lastname@example.org> wrote:
> I am new to using GNUPLOT and am trying to find the best fit line (to
> determine the slope) of a line that follows Power Law (is an
> exponential line).
First, a terminology issue: an exponential curve doesn't have a
"slope" to speak of. More precisely, the slope is different at every
place, so it's not a property of the curve as such, but of each point
on the curve.
> I realize I have to use a function f(x) = a*b**x.
That's one way of expressing it. f(x)=a*exp(x/k) or
f(x)=exp(b1*(x-x0)) and any variations of those may be just as valid
> But, I do not know what to do next. Any help in this matter would be
> greatly appreciated.
Read through "help fit" and you should be on your way.
Hans-Bernhard Broeker (email@example.com)
Even if all the snow were burnt, ashes would remain.
On Tuesday 04 May 2004 12:53, Divya Rao (firstname.lastname@example.org) held forth
> I am new to using GNUPLOT and am try...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.
f...least square fit
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.
> 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.
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote'...least squares algorithm
Any one know where can I find some php code (or "php-able" code)
implementing least squares method?
Thx in advance and pls excuse my poor eng
> Hello All!
> Any one know where can I find some php code (or "php-able" code)
> implementing least squares method?
> Thx in advance and pls excuse my poor eng
On 13 Feb, 12:42, Janwillem Borleffs <j...@jwscripts.com> wrote:
> J.SanTanA schreef:
> > Hello All!
> > Any one know where can I find s...Best Fit Line
I have a problem that is puzzling me for very long.I got this
problem of fitting in 80 over text files and within each txt file,it
contains about 120 datas.I want to from these datas generate a best
fit line to cut through all these points.The program I am now using is
Matlab.Please help and reply asap,as I need the info urgently.
In article <a488ubsdofj7@legacy>,
email@example.com (Eid) writes:
> I have a problem that is puzzling me for very long.I got this
>problem of fitting in 80 over text files and within each t...Line of best fit
I'm a total newbie at this guys.
I have the following data in an .m file:
x = 0:2:20;
y = [0.02 0.26 0.35 0.53 0.66 0.78 0.88 0.96 1.03 1.06 1.14];
How would i fit a line of best fit to this graph?
I know this is rudimentary stuff but as i said i'm a total newbie!!!
Cheers for any help
Jamie Sutton wrote:
> I'm a total newbie at this guys.
> I have the following data in an .m file:
> x = 0:2:20;
> y = [0.02 0.26 0.35 0.53 0.66 0.78 0.88 0.96 1.03 1.06 1.14];
> How would i fit...Least square fitting
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)
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?
"xety89 " <firstname.lastname@example.org> wrote in message <email@example.com>...
> 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?
Hmm. I have a funny feeling that your expression
is wrong. Everything about that expression is a
simple, cumulative normal, except for that you
square theta, as opposed to squaring the difference
Beyond that, your expression is not meaningful in
terms of the data that you have. You are talking
about doing some sort of a nonlinear least squares
fit to that expression, but that expression cannot
...Least square fitting
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...Line of best fit
I am new to python so apologies for the ignorance with this question.
How would I apply a line of best fit to a plot?
My data are netCDF4 data files and this is essentially what I have done so far:
Content-Type: text/plain; charset=UTF-8
None of these are in the standard library but why re-invent the wheel?
Using numpy:...Least squares fitting
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 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
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
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
In article <firstname.lastname@example.orgYaTP>,
"Shar P" <email@example.com> writes:
>I tried to use lsqlin to do a least square fit with 3 constraints. I
>had 7 variables. However it ...Best fit line?
Hi. Is there a function to calculate/plot the best fit line
given a few (approx 3) points? I don't have any toolboxes,
nor can I afford any.
Can any function in the basic matlab application do this?
"Amir " <amirschricker.DELETE@DELETE.gmail.DELETE.com> wrote in message
> Hi. Is there a function to calculate/plot the best fit line
> given a few (approx 3) points? I don't have any toolboxes,
> nor can I afford any.
> Can any function in the basic matlab application do this?
J...least square fitting
dear Gnuplot users,
I am using the following command to fit a set of data:
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,
how can I get five decimal digits like a=0.00001, b=0.91112 ?
David <firstname.lastname@example.org> wrote:
> dear Gnuplot users,
> I am using the following command to fit a set of data:
> 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,
"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 (email@example.com)
Even if all the snow were burnt, ashes would remain.
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:
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?
David <firstname.lastname@example.org> wrote:
> Below is the c...least square fit
I have the following data file:
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
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
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?
"Share what you know. Learn what you don't."
Bart Vandewoestyne wrote:
> I have the following data file:
> 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 curve fit
I have an equation of y=k/a(1 -exp(-at)),and a set of data y=[1
2....];t=[2 3...]. is it possible to find the value of k and a by
least square curve fitting?
You could use something like:
> I have an equation of y=k/a(1 -exp(-at)),and a set of data y=[1
> 2....];t=[2 3...]. is it possible to find the value of k and a by
> least square curve fitting?
In article <email@example.comYaTP>,
annie <firstname.lastname@example.org> writes:
>I have an...Weighted Line of Best Fit
At the moment I am writing code to find the weighted line of best
fit. I can calculate the line of best fit using the code given below,
where sortWLAN corresponds to the entries in an array, which I want
onedist = sortWLAN(3,1:100);
onerssi = sortWLAN(4,1:100);
onewgt = sortWLAN(5,1:100);
coeffs = polyfit(onedist,onerssi, coefficient);
curvefit = polyval(coeffs, distance);
plot(onedist, onerssi, 'o');
Anybode have any ideas? Cheers
> At the moment I am writing code to find the weighted line of best
&...nonlinear best-fit line
I am having trouble trying to figure out how to fit a nonlinear best fit
line to my data in SAS. Any help would be greatly appreciated.