Fitting least square approximations

  • Thread starter Thread starter Gameowner
  • Start date Start date
  • Tags Tags
    Fitting Square
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
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: 521
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.