How do I use Least Square Fitting to Calculate the Best Line of Fit?

  • Context: Undergrad 
  • Thread starter Thread starter EngNoob
  • Start date Start date
  • Tags Tags
    Fitting Line Square
Click For Summary

Discussion Overview

The discussion revolves around the application of Least Square Fitting to calculate the best line of fit, focusing on the challenges encountered with matrix operations, particularly the inversion of matrices involved in the process.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant seeks guidance on using Least Square Fitting, specifically struggling with the inverse matrix aspect.
  • Another participant notes that there are various methods to find least squares lines, questioning the specific matrix the original poster is referring to.
  • A participant describes their process involving matrices "A" and "B" and their attempt to compute the inverse of matrix "C," expressing confusion over the determinant and the resulting inverse compared to a known solution.
  • One reply suggests considering reducing fractions as a potential oversight in the calculations.
  • The original poster later reports resolving their issue by transposing matrix "A" to compute ATA, which allowed them to correctly calculate the determinant and inverse.

Areas of Agreement / Disagreement

The discussion reflects a progression from confusion to resolution for the original poster, but it does not indicate a consensus on the best approach to Least Square Fitting, as multiple methods and perspectives are mentioned.

Contextual Notes

Limitations include the original poster's initial lack of clarity in their matrix operations and the potential for misunderstanding in the matrix inversion process. The discussion does not fully explore all methods of Least Square Fitting.

EngNoob
Messages
32
Reaction score
0
Hey

I need to use the Least Square Fitting approach to calculating the best line of fit.

I have read loads, and can't seem to figure out how to get passed the Inverse matrix part?

Anyone know any good links, or can guide me on how to do least square fitting?

Thanks
 
Physics news on Phys.org
There are about a dozen different way of finding "least squares" lines, some of which use matrices. What matrix are finding an Inverse matrix for? What do you mean "get passed the inverse matrix".
 
Ok, here is what i have done

I have matrix "A" Matric "B".

Using Matrix "A" i can get "Matrix C"

I then inverse matrix "C", However, the numerical approach i am taking is giving me the wrong matrix where i compare it with a inverse from Maple

here is my matrix C

[ 4 ] [ 8 ]
[ 8 ] [26]

From this i get det (40)

I know the answer is

1/20 [13][-4]
[-4][ 2]

I however don't get this...

So i am stuck on inversing the matrix.

i get det C at 1/40 and not 1/20
 
Since you refuse to show us what you did I can only suggest one thing: have you considered reducing fractions?
 
Sorry...

I have solved this now...

I never transposed matrix "A" to for ATA, once i have transposed then i got all the values for the determinent and inverse and ultimatly the solution.

Matrix A and B:

[■(1&1@1&3@1&7@1&4)] [■(C@D)]= [■(3@8@5@7)]

Transpose A to produce ATA

A^T A= [■(1&1&1&1@1&3&7&4)] [■(1&1@1&3@1&7@1&4)]= [■(4&15@15&75)]


This is how i solved it. thanks again for the help.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 18 ·
Replies
18
Views
13K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
24
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K