How can I use MATLAB for curve fitting and generating an equation for g(f)?

  • Thread starter coffeem
  • Start date
  • Tags
    Matlab
In summary, the conversation is about a second year University student in the UK trying to use MATLAB for curve fitting. They have found conflicting information in books and are struggling to use the Curve fitting tool. They also mention needing to generate the function of g(f) using a sample data set, but would prefer pointers instead of a direct answer. They need to have this figured out by tomorrow.
  • #1
coffeem
91
0

Homework Statement



Hi, I am a second year University student in the UK. I am trying to plan my labs and as part of this am trying to work out how I use MATLAB to do some curve fitting. What I wish to do is to get some points and for MATLAB to find me an equation of this curve to a reasonable degree of accuracy. I then need to square this function and finally to integrate it over some limits.

However I have looked up how to do this in a couple of books in my university library and have so far been unable to complete even the first part of this task. In the books which I found on this I am told to use the 'Basic Fitting' function. However the version of MATLAB which I have only has the Curve fitting tool, which does not appear to give me an equation but merely draws a pretty line for me, after around three hours of playing around this is getting somewhat tiresome.

Note - the sample data which I have been trying to use can be downloaded from: http://www.nottingham.ac.uk/~ppzwm/downloadsindex.htm and clicking on the g_of_f.mat link under the Johnson Noise heading. I need to generate the function of g(f). However I would rather that you told me how to do this rather than just providing me with the answer as I have to do this again independently.

Thanks
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Hey can someone please give me some pointers for this. I need to have this figured out by tomorrow.
 
  • #3


I can understand your frustration with trying to figure out how to use MATLAB for curve fitting. It can be a complex and time-consuming task, especially if you are new to the program. First of all, I would recommend checking if your university has any resources or workshops available for students to learn how to use MATLAB for data analysis. This could provide you with some hands-on guidance and support.

In general, there are several approaches you can take for curve fitting in MATLAB. One option is to use the Curve Fitting Toolbox, which allows you to fit various types of curve models to your data. Another option is to use the "fit" function, which is part of the Statistics and Machine Learning Toolbox. This function allows you to specify the type of model you want to fit and the data you want to fit it to.

In terms of your specific task of finding an equation for g(f) and then squaring and integrating it, you can try using the "fit" function with a custom equation. You can also try using the Curve Fitting Toolbox and selecting a suitable model for your data. If you are still having trouble, I would recommend reaching out to your instructor or a teaching assistant for further assistance, as they may be able to provide more specific guidance for your assignment. Good luck!
 

1. What is Matlab curve fitting?

Matlab curve fitting is a statistical technique used to find the best fit for a set of data points by comparing different mathematical models and selecting the one that best represents the data.

2. How does Matlab curve fitting work?

Matlab curve fitting uses the least squares method to minimize the sum of the squared errors between the data points and the chosen mathematical model. This is done through an iterative process of adjusting the model parameters until the best fit is achieved.

3. What types of data can be used for Matlab curve fitting?

Matlab curve fitting can be used for any type of data that can be represented by a mathematical model, such as numerical, categorical, or even symbolic data. It can also handle data with missing values or outliers.

4. How accurate is Matlab curve fitting?

The accuracy of Matlab curve fitting depends on the quality of the data and the appropriateness of the chosen mathematical model. It is always important to carefully analyze the results and consider the limitations of the model being used.

5. Can Matlab curve fitting be used for time series data?

Yes, Matlab curve fitting can be used for time series data by treating time as an independent variable in the mathematical model. This allows for the prediction of future values based on the fitted curve.

Similar threads

  • Introductory Physics Homework Help
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • Precalculus Mathematics Homework Help
Replies
7
Views
1K
  • Advanced Physics Homework Help
Replies
1
Views
956
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • Introductory Physics Homework Help
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
837
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Back
Top