Curve Fitting in Matlab: Harry's Experience

In summary, the speaker is struggling to fit a polynomial to a large set of data in Matlab and is seeking advice and potential solutions from others. They mention other curve fitting options but express a preference for a function that can be used for manipulation. They also suggest looking into Lagrange polynomials or spline curve fits for assistance.
  • #1
H_man
145
0
Hi,

I've just been trying unsuccessfully to fit a polynomial to a large set of data in Matlab (1301 points). I want to fit a polynomial to the data so that I have a function with which to try and manipulate the data in different ways.

I have no problem fitting polynomials to much smaller sets of data. I know that other curve fitting options exist, such as the moving average. However, it is my understanding that they do not return a function which can be used (so it seems it is just for presentation).

Has anyone had any experience with this?

Thanks, :confused:

Harry
 
Physics news on Phys.org
  • #2
Do a search on the Mathworks web site, there is a bunch of code that can be looked at to help you along. Look in your numerical analysis text for Lagrange polynomials or spline curve fits.
 
  • #3


Hello Harry,

I'm sorry to hear that you have been having trouble fitting a polynomial to your large set of data in Matlab. Fitting curves to data can often be a challenging task, especially with a large number of data points.

One possible solution could be to try using a different curve fitting method, such as nonlinear least squares or spline interpolation, which may be better suited for your data set. Additionally, you may want to consider pre-processing your data to remove any outliers or smooth out any noise before fitting the curve.

I understand your concern about wanting to have a function that can be used for manipulation, and while some curve fitting methods may not return a function, they can still provide valuable insights and visualizations for your data. I would recommend exploring different options and experimenting with different parameters to find the best fit for your data.

I hope this helps and good luck with your curve fitting!
 

FAQ: Curve Fitting in Matlab: Harry's Experience

1. What is curve fitting in Matlab?

Curve fitting in Matlab is a process of finding a mathematical function that best represents a set of data points. It involves finding the best fitting curve that passes through the data points and can be used to make predictions or analyze the data further.

2. What are the benefits of using Matlab for curve fitting?

Matlab has built-in functions and tools specifically designed for curve fitting, making the process quick and efficient. It also has a wide range of curve fitting algorithms to choose from, allowing for greater flexibility in finding the best fit for your data.

3. What types of curves can be fitted using Matlab?

Matlab can fit a variety of curves, including linear, polynomial, exponential, logarithmic, and power curves. It also has the ability to fit custom curves using user-defined equations.

4. How do I evaluate the accuracy of a curve fit in Matlab?

There are several ways to evaluate the accuracy of a curve fit in Matlab. One way is to calculate the coefficient of determination (R-squared value), which indicates how well the curve fits the data. You can also visually compare the fitted curve to the original data points or use statistical tests to determine the significance of the fit.

5. Can I export the fitted curve from Matlab to use in other programs?

Yes, Matlab allows you to export the fitted curve as a function or as a set of data points. This can be useful if you want to use the curve in other programs or if you want to plot it alongside other data in a different software.

Similar threads

Replies
2
Views
1K
Replies
6
Views
4K
Replies
1
Views
1K
Replies
12
Views
3K
Replies
2
Views
2K
Replies
1
Views
3K
Replies
1
Views
3K
Replies
1
Views
2K
Back
Top