Find coefficients for a unified model for fitting negative and positive output

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Find coefficients for a unified model for fitting negative and positive output

insafba
Hello everyone,
well, I'm trying to fit my data corresponding to points of the contour of a
circle to a model. the problem I have is, as I have data for a circle, I
have negative and positive values for the radius. So the model has to fit
for both values. I want from this fitting data process to find out the
coefficients of my model the permit to approach the max possible to the true
values of the radius.
I've tried two methods: I used the function "leasqr" from the Octave package
"optim", and I used the function "fmin" to search the min of the sum of the
squared errors.
the problem with the two methods is that I have to separate my data into two
sets: negative and positive, which cause different values of coefficients
(which is not what I'm seeking).
Another problem is that I want to calculate the best coefficients so my data
be the nearest possible to the nominal value, which I don't know how to do
it; when I use "leasqr" it gives me the number of iterations and the final
parameters, but I want to know the parameters calculated at each iteration
and continue until having the best ones.
please find attached two plots to understand the problem (the fitted plot is
far from the nominal value 10)
I'll appreciate any help you could provide me
<http://octave.1599824.n4.nabble.com/file/t373159/fitting_with_leasqr.png>



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Find coefficients for a unified model for fitting negative and positive output

Doug Stewart-4


On Tue, Jan 29, 2019 at 5:25 PM insafba <[hidden email]> wrote:
Hello everyone,
well, I'm trying to fit my data corresponding to points of the contour of a
circle to a model. the problem I have is, as I have data for a circle, I
have negative and positive values for the radius. So the model has to fit
for both values. I want from this fitting data process to find out the
coefficients of my model the permit to approach the max possible to the true
values of the radius.
I've tried two methods: I used the function "leasqr" from the Octave package
"optim", and I used the function "fmin" to search the min of the sum of the
squared errors.
the problem with the two methods is that I have to separate my data into two
sets: negative and positive, which cause different values of coefficients
(which is not what I'm seeking).
Another problem is that I want to calculate the best coefficients so my data
be the nearest possible to the nominal value, which I don't know how to do
it; when I use "leasqr" it gives me the number of iterations and the final
parameters, but I want to know the parameters calculated at each iteration
and continue until having the best ones.
please find attached two plots to understand the problem (the fitted plot is
far from the nominal value 10)
I'll appreciate any help you could provide me
<http://octave.1599824.n4.nabble.com/file/t373159/fitting_with_leasqr.png>



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



If you convert your numbers tp polar coordinates  then you would have a radius and an angle. the radius would always be positive.
--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: Find coefficients for a unified model for fitting negative and positive output

insafba
Thank you for replying,
actually, this is what I did, but when I assume that the radius values are
positive, I get a completely messy figure as below. but that's doesn't
matter. the problem is how to approach the max possible to the true value
(which is in my case 10) and how to recalculate the coefficients by
successive iterations until finding a satisfying result?
<http://octave.1599824.n4.nabble.com/file/t373159/fitting_with_leasqr_radiusallpositive.png>



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Find coefficients for a unified model for fitting negative and positive output

Doug Stewart-4


On Wed, Jan 30, 2019, 6:47 AM insafba <[hidden email] wrote:
Thank you for replying,
actually, this is what I did, but when I assume that the radius values are
positive, I get a completely messy figure as below. but that's doesn't
matter. the problem is how to approach the max possible to the true value
(which is in my case 10) and how to recalculate the coefficients by
successive iterations until finding a satisfying result?
<http://octave.1599824.n4.nabble.com/file/t373159/fitting_with_leasqr_radiusallpositive.png>



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

If your true data is a circle , then the radius is a constant and  should show up as a horizontal straight line.
Do you think  that the true radius is 10?
If you want to find a horizontal straight line you could put six or seven copies of your raw data end to end and then do a normal straight line approximation and see what you get.

You're raw data sure doesn't look like it's part of a pure Circle



Reply | Threaded
Open this post in threaded view
|

Re: Find coefficients for a unified model for fitting negative and positive output

insafba
well, the data is issued from a 3D scan of a fabricated part, so that's why
there some deviations. and in fact, I want to model this deviation, so the
idea is to fit the data to a model and make it approach the max possible to
the true value 10.
I don't know therefore how to do successive iterations to find the best
coefficients



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Find coefficients for a unified model for fitting negative and positive output

Doug Stewart-4


On Wed, Jan 30, 2019 at 8:43 AM insafba <[hidden email]> wrote:
well, the data is issued from a 3D scan of a fabricated part, so that's why
there some deviations. and in fact, I want to model this deviation, so the
idea is to fit the data to a model and make it approach the max possible to
the true value 10.
I don't know therefore how to do successive iterations to find the best
coefficients



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



you started by saying 
"
I'm trying to fit my data corresponding to points of the contour of a
circle to a model.
"
Now you say it is not a circle!!

What do you mean when you say its true value is 10?????
I can't help you when you don't tell me what is the real problem.




--
DASCertificate for 206392