forum.alglib.net
http://forum.alglib.net/

Least sqaure fitting using lslfitlinear(...)
http://forum.alglib.net/viewtopic.php?f=2&t=578
Page 1 of 1

Author:  christian_blesing [ Mon May 14, 2012 6:50 pm ]
Post subject:  Least sqaure fitting using lslfitlinear(...)

Hi,

I'm a complete newbie with ALGIB, so sorry for this post.
i want to fit Data from a laser scanner to a elliptical function like this: A*x?+B*x*y+y? + 1 = 0
My laser scanner interface gives points(x/y).
For this task i want to use the lslinearfit(...) method.
But i'm confused about the function parameter. The first one called "y" is the experimental data array but how do i arrange the x/y value pairs in this 1d array?
The second parameter "fmatrix" should be a matrix of basis functions calculated at sample points. In my case i only got one... How many sample points i have to calculate?
I Hope someone can help me with it.


Many Thanks

Author:  Ray [ Wed Jun 20, 2012 10:01 pm ]
Post subject:  Re: Least sqaure fitting using lslfitlinear(...)

Hello christian_blesing!
Did you solved your problem? I have simmilar problem. I'm using triangulation laser, so I move this Laser along the x-axis and measure the distance to a cylinder. As result I get a profile of the cylinder, that means I get points that can be fitted by a circle function. I tried the nonlinear fitting using func=sqrt(r^2-(x-x_m)^2)+y_m, but without usable results.

Author:  Ray [ Fri Jun 22, 2012 7:23 pm ]
Post subject:  Re: Least sqaure fitting using lslfitlinear(...)

Choosing func=(x-x_m)^2+(y-y_m)^2-r^2 it works very good.

Author:  christian_blesing [ Sat Jun 23, 2012 11:45 am ]
Post subject:  Re: Least sqaure fitting using lslfitlinear(...)

hey Ray,

thx for your relpy! I have not solved the problem completly yet, but it works acceptable with many additional filters to locate the false detected elliptical parts. I use the function lsfitlinear() and put my scanner values (x,y) as sample data into the function. Now the current scan segment is testet with the sample data. I dont know if there is a better way to use this funktion. I've read things that you can giva a function like f(x)= x?+2xy.... to the lsfitlinear() function. Maybe this would work better as use the sample data in (x,y) form.

viewtopic.php?f=2&t=588

in this topic i have discribed the problem. As you can see i detect a lot of straight lines .....

maybe you can help me how you put the func=(x-x_m)^2+(y-y_m)^2-r^2 to the alglib method?

many thanks

christian

Author:  Ray [ Sun Jun 24, 2012 6:54 pm ]
Post subject:  Re: Least sqaure fitting using lslfitlinear(...)

Hey!
I'm not sure, if I understood your pictures, but here you can see how I made it with my problem: viewtopic.php?f=2&t=591 Please look at the file main1 and not at main. There the issue is explained well and with the Help of mr. Bochkanov it works well too. I hope it will be a Help. And if there are still questions, please ask me :-).

Author:  Ray [ Sun Jun 24, 2012 7:20 pm ]
Post subject:  Re: Least sqaure fitting using lslfitlinear(...)

Hey here is the already corrected version. The comments in the code are partially in german , but if you look in the link I posted before, there the comments are completely in english.

Attachments:
graph_2.jpg
graph_2.jpg [ 38.45 KiB | Viewed 5762 times ]
main1.cpp [4.38 KiB]
Downloaded 682 times

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/