Fitting least square approximations

  • Thread starter Thread starter Gameowner
  • Start date Start date
  • Tags Tags
    Fitting Square
Click For Summary
SUMMARY

The discussion focuses on implementing least square approximations using MATLAB, specifically through the normal equations method. The user outlines the matrices A, b, and x, with A defined as a matrix of polynomial basis functions. The solution involves defining these matrices without numerical data points, utilizing MATLAB's capabilities to create a vector of time values and construct the matrix A accordingly. The advice given includes reordering basis functions into even and odd groups to simplify the problem.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of least squares approximation methods
  • Knowledge of matrix algebra and normal equations
  • Basic concepts of polynomial functions and their properties
NEXT STEPS
  • Explore MATLAB's matrix operations and syntax for defining matrices
  • Research the implementation of normal equations in MATLAB
  • Learn about QR factorization and its application in least squares problems
  • Investigate the concept of even and odd functions in polynomial approximations
USEFUL FOR

Students and researchers in mathematics or engineering fields, particularly those working on numerical methods and data fitting using MATLAB.

Gameowner
Messages
43
Reaction score
0

Homework Statement



Attached

Homework Equations





The Attempt at a Solution



Thanks in advance for the help.

The problem I'm having is not so much as to how to solve the problem, but how to proceed using MATLAB. I'm having trouble figuring out how to enter in the respective components of this question into MATLAB.

The method I will try to solve this is by normal equations. To do this, I have to at least first specify what my A, b and x matrix/vectors are.

From here, I had that A is a matrix given by

A = [1 t1^2 t2^3 t3^4]
[1 t1^2 t2^3 t3^4]
[etc ]

and x is given by

x = [x1]
[x2]
[x3]
[x4]

b is given by

b = [phi(1)]
[phi(2)]
[phi(3)]
[phi(4)]

So my question is, how do I define these into matrix form without having actual numerical data points? We've only been shown how to approximate using normal equations/QR factorization, but with numerical data points, hence we could define the matrices.

I had to begin with

t = -1:0.1:1
A = [t.^0 , t.^1, t.^2, t.^3]

then after entering in the matrices, would then proceed to using backslash to solve hence plotting the approximation?

Any help, hint would be much appreciated.
 

Attachments

  • Q6.jpg
    Q6.jpg
    22.8 KB · Views: 510
Physics news on Phys.org
Gameowner - lookup the topic "Continuous Least Squares". This addresses the problem that you have. And yes, constructing the Normal equations is correct approach, only you need to do it on the continuous domain.

One other suggestion; since your domain interval is symmetric about origin, consider re-ordering the basis functions into groups of even functions, followed by odd functions. Once you do that, this problem reduces to 2 simple manual excercises.
 

Similar threads

Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 34 ·
2
Replies
34
Views
3K
Replies
12
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
2
Views
2K
Replies
2
Views
2K
Replies
8
Views
3K