Link to home
Start Free TrialLog in
Avatar of imran89
imran89

asked on

Least Squares Data Fit Implementation...

Hello Experts,

I am developing a mathematical module for my application and I am required to implement a Least Squares Data Fit algorithm in C#. Can anyone direct me to resources on line that have an implementation or can anyone with a strong mathematical background guide me to the solution.

Basically I have a set of coordinates that define a curve and I would like to use these points to a derive an equation of nth order (could be 2nd, 3rd, 4th etc) that represent these points.

Please cany anyone help.

Thanking you in advance.

Imran
ASKER CERTIFIED SOLUTION
Avatar of NTAC
NTAC

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of imran89
imran89

ASKER

Thankyou for responding NTAC.

Ideally I would like to implement it myself but I assume the task is too daunting. Do you have any experience with this type of algorithm?

Is it easy to integrate Mapack with an application?

regards Imran
Avatar of imran89

ASKER

NTAC,

Another point that I forgot to mention was that how difficult the algorithm would become if I required the facility to select the order of the derived equation and whether to perform a straight line fit or a curve fit.

regards Imran
Imran

Sorry for the delay in responding

It is very easy to use the Mapack with your application.  If you are using Visual Studio--you can add the mapack dll to your project--then have the line: using Mapack; at the top of yoru file.  Then you can call any of the functions their dll has implemented.

As for your second question, I'm not sure if mappack has the flexibility to do that or not.  You can check the readme--I did but I don't understand the math (its been a few years out of school for me).  

Good luck
NTAC
Avatar of imran89

ASKER

Thanks for responding NTAC.

Do you have any experience in using the least squares functionality as it is with Mapack. If there are a few mathematical commands to process, are you aware of them?


Thanks

regards Imran
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of imran89

ASKER

Thankyou for responding TAD and thanks for the theory.

A pure solution for least squares seems a very involved task and my math is very weak to tackle such a thing. I was hoping the algorithm was not as involved.

I will then need to focus on finding an exisitng implementation of least squares in C#. I know libraries like Mapack exist (thanks to NTAC) but I dont know if it will do the job.

I am dealing with around 50 coordinates at a time and require to find an equation most probably at cubic or quartet level hence having the option to choose the nth degree.

Are you aware of C# implementation of least squares upto quartet level?

Thanking you in advance

regards Imran


I am not aware of any .Net package that does what you are asking, although they may exist.


Something that may help you is to look at some applications geared for mathematical computations (like MatLab) and see if you can find what you are looing for there and borrow some of the logic of their code.

Sorry I can't be of more help.
Avatar of imran89

ASKER

Thankyou very much for both of your assistance.

NTAC and _TAD_, both of you have provided me with pointers to start research on.

regards Imran