Fitting least square approximations

  • Thread starter Thread starter Gameowner
  • Start date Start date
  • Tags Tags
    Fitting Square
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: 484
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.
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top