Fitting least square approximations

In summary, the conversation revolves around a problem involving normal equations and matrix manipulation in MATLAB. The solution involves constructing the normal equations on the continuous domain and considering re-ordering the basis functions into groups of even and odd functions.
  • #1
Gameowner
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

  • Q6.jpg
    Q6.jpg
    22.8 KB · Views: 445
Physics news on Phys.org
  • #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 to Fitting least square approximations

1. What is a least square approximation?

A least square approximation is a mathematical method for finding the best fit line or curve that minimizes the sum of the squared differences between the actual data points and the predicted values. It is commonly used in statistics and data analysis to find a linear relationship between two variables.

2. How does the least square method work?

The least square method works by calculating the sum of the squared differences between the actual data points and the predicted values based on a given model or equation. The goal is to find the line or curve that minimizes this sum, resulting in the best fit for the data. This is typically achieved through a process of trial and error, adjusting the parameters of the model until the sum of squared differences is minimized.

3. What is the purpose of fitting least square approximations?

The purpose of fitting least square approximations is to find a mathematical representation of the relationship between two variables that best describes the data. This allows for better understanding and prediction of future data points, and can also be used to identify trends and patterns in the data.

4. What are the assumptions made when using least square approximations?

There are a few key assumptions that are typically made when using least square approximations. These include the assumption that the errors in the data are normally distributed, there is a linear relationship between the variables, and the errors are independent of each other. It is important to check these assumptions before using the method to ensure accurate results.

5. What are some potential limitations of least square approximations?

While least square approximations can be a useful tool for finding a best fit line or curve, there are some limitations to consider. For example, the method may not work well if the data is not normally distributed or if there are outliers that significantly affect the result. Additionally, the method assumes a linear relationship between the variables, so it may not be the best approach for data sets with more complex relationships.

Similar threads

Back
Top