• Support PF! Buy your school textbooks, materials and every day products Here!

Fitting least square approximations

  • Thread starter Gameowner
  • Start date
  • #1
45
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

Answers and Replies

  • #2
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.
 

Related Threads for: Fitting least square approximations

  • Last Post
Replies
3
Views
862
  • Last Post
Replies
7
Views
667
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
2
Views
897
  • Last Post
Replies
12
Views
2K
  • Last Post
Replies
4
Views
1K
Replies
2
Views
638
  • Last Post
Replies
10
Views
2K
Top