forum.alglib.net

ALGLIB forum
It is currently Mon Dec 23, 2024 4:48 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Least sqaure fitting using lslfitlinear(...)
PostPosted: Mon May 14, 2012 6:50 pm 
Offline

Joined: Mon May 14, 2012 4:35 pm
Posts: 5
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


Top
 Profile  
 
 Post subject: Re: Least sqaure fitting using lslfitlinear(...)
PostPosted: Wed Jun 20, 2012 10:01 pm 
Offline

Joined: Tue Jun 19, 2012 9:27 am
Posts: 10
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.


Top
 Profile  
 
 Post subject: Re: Least sqaure fitting using lslfitlinear(...)
PostPosted: Fri Jun 22, 2012 7:23 pm 
Offline

Joined: Tue Jun 19, 2012 9:27 am
Posts: 10
Choosing func=(x-x_m)^2+(y-y_m)^2-r^2 it works very good.


Top
 Profile  
 
 Post subject: Re: Least sqaure fitting using lslfitlinear(...)
PostPosted: Sat Jun 23, 2012 11:45 am 
Offline

Joined: Mon May 14, 2012 4:35 pm
Posts: 5
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


Top
 Profile  
 
 Post subject: Re: Least sqaure fitting using lslfitlinear(...)
PostPosted: Sun Jun 24, 2012 6:54 pm 
Offline

Joined: Tue Jun 19, 2012 9:27 am
Posts: 10
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 :-).


Top
 Profile  
 
 Post subject: Re: Least sqaure fitting using lslfitlinear(...)
PostPosted: Sun Jun 24, 2012 7:20 pm 
Offline

Joined: Tue Jun 19, 2012 9:27 am
Posts: 10
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 5765 times ]
main1.cpp [4.38 KiB]
Downloaded 682 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group