10-27-2006 04:59 PM
10-27-2006 05:32 PM
10-30-2006 09:45 AM - edited 10-30-2006 09:45 AM
We cannot debug your code unless you attach it
Message Edited by RWiersma on 10-30-2006 09:47 AM
10-30-2006 10:17 AM
11-01-2006 05:02 PM
11-01-2006 07:03 PM
@RWiersma wrote:
The theory I'm working on here is finding a best-fit plane through some data.
Well, then this should have been the title of your thread! 😄
Whatever you are doing is extremely tedious! You can just use general LS fit and do it with some simple code the size of a postage stamp. 🙂
Long ago I wrote a much more complicated demo (fitting points to a 2D polynomial plane of arbitrary order) and it would be trivial to adapt it to your problem, just delete 90% of the code and only leave order=1 ;).
Check out my old demo: http://forums.ni.com/ni/board/message?board.id=170&message.id=129944#M129944
(Ignore the Levenberg-Marquardt alternative code).
11-01-2006 09:10 PM
11-02-2006 08:39 AM
Ahh yes... good spot! Wish I could turn on uninitialized-variable notification or something (ala Option Explicit, in VB). Thanks for the note.
I've just looked over your code quickly, but one problem I see is that you aren't passing "N" to your cluster. The default is 4. I tried to plot some data and the result still isn't correct.
11-02-2006 08:43 AM - edited 11-02-2006 08:43 AM
@altenbach wrote:
OK, here's a quick draft, using my old 2D polynomial function set to n=1. If you want, you can hardcode them for a simple plane.See if this makes sense to you.It probably needs more work....
Wow. That's a very pleasant surprise 🙂 I figured there was a better way to do this, but I just didn't know what I was looking for.
It looks like you nailed it. I can work with this, quite likely.
I greatly appreciate your time and assistance!
Message Edited by RWiersma on 11-02-2006 08:44 AM
11-03-2006 10:37 AM
@altenbach wrote:
OK, here's a quick draft, using my old 2D polynomial function set to n=1. If you want, you can hardcode them for a simple plane.See if this makes sense to you. 🙂It probably needs more work....
Now the next question is.... can this module report flatness of the cloud? I guess...that would be residue from the plane-to-data fit, but I don't see a residue output.
Any suggestions?