# Matlab Linearization: Best Approximation Using Polyfit

• MATLAB
• IlyaZ
In summary, the conversation revolves around finding the best approximation for a x^2 curve from an experiment stored in Matlab. The individual tried using polyfit but did not get the desired result. It was suggested to polyfit the log values of the data instead of the actual values. The individual is grateful for the suggestion and believes it solved the problem.
IlyaZ
Hello,

this is my situation: I've got some data from an experiment stored in matlab. So I plot the graph and get a x^2 curve. I plot the loglog graph and see a near-"perfect" line. Now I want to create the best approximation to it (in a least squares sense).

I don't want to do that manually as it's a tedious process. So I tried polyfit, but when I compare the line generated by polyfit to the line from the experiments + after applying loglogging it doesn't match at all.

I take it I made something wrong, but I don't get what.

Try polyfitting the log values of the data you obtained, instead of polyfitting the actual values and then plotting the log plot thereafter. If that doesn't work, then show the data you obtained and the Matlab code you used here. That helps in pinpointing where you go wrong.

Btw, I think this thread is more relevant in the Homework section.

## What is the purpose of Matlab linearization and best approximation using polyfit?

The purpose of Matlab linearization is to find a linear approximation for a given set of data points. Polyfit is a function in Matlab that uses the method of least squares to find the best fitting polynomial curve for the data points.

## What is the difference between linearization and best approximation using polyfit?

Linearization involves transforming a non-linear relationship between two variables into a linear one, while best approximation using polyfit involves finding the best fitting polynomial curve for a given set of data points.

## How does polyfit determine the best fitting polynomial curve?

Polyfit uses the method of least squares to minimize the sum of squared errors between the data points and the polynomial curve. This results in a polynomial curve that best fits the data points.

## What types of data can be linearized and approximated using polyfit in Matlab?

Polyfit can be used for any type of data that can be represented by a polynomial curve, including numerical data, time series data, and experimental data.

## Are there any limitations to using polyfit for linearization and best approximation?

Polyfit may not be the best approach for data sets with large outliers or for data sets with a non-polynomial relationship. It is important to carefully examine the data and consider other methods if necessary.

• MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
5K
• Calculus and Beyond Homework Help
Replies
10
Views
1K
• MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
3K
• MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
8K
• MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
5K
• MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
• MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K