What function should I fit to this data?

In summary: Actually each data point shown above, was an average of an even noisier data set. Since I changed the electron volts every 2 seconds, I took the average of the voltage every two seconds. So using moving average would make the data even more cleaner? Do you know any smoothing functions from numpy?
  • #1
gothloli
39
0

Homework Statement


I'm supposed to find the first ionization energy of a gas (Argon), and to do that I used mass spectrometer. The data I plotted was amplifier voltage (acts as Ion current) vs. electron volts. The graph appears in the attachment as data2.jpeg.
To find the ionization energy I'm supposed to take the first and second derivative of the data, and the max x-value of the data is the ionization energy. When I do that the plot of the derivatives is not smooth; the points fluctuate. So I decided to fit a function to the data, and then take the derivative.

Homework Equations


I fitted using curve_fit on numpy, python 2.7. and tested the goodness of fit using chi-squared/dof. The fit was bad.

The Attempt at a Solution


I used the logistic function defined here http://en.wikipedia.org/wiki/Logistic_function, with parameters, (0.026, 0.745, 19.0, 0.0005). The fitted function is shown here. Since the fit was not good, is there a better function to fit this kind of data, or is there a better way to find the derivatives of the data?
data.jpeg


data.jpeg
 

Attachments

  • data2.jpeg
    data2.jpeg
    18.6 KB · Views: 468
Last edited:
Physics news on Phys.org
  • #2
gothloli said:

Homework Statement


I'm supposed to find the first ionization energy of a gas (Argon), and to do that I used mass spectrometer. The data I plotted was amplifier voltage (acts as Ion current) vs. electron volts. The graph appears in the attachment as data2.jpeg.
To find the ionization energy I'm supposed to take the first and second derivative of the data, and the max x-value of the data is the ionization energy. When I do that the plot of the derivatives is not smooth; the points fluctuate. So I decided to fit a function to the data, and then take the derivative.

Homework Equations


I fitted using curve_fit on numpy, python 2.7. and tested the goodness of fit using chi-squared/dof. The fit was bad.

The Attempt at a Solution


I used the logistic function defined here http://en.wikipedia.org/wiki/Logistic_function, with parameters, (0.026, 0.745, 19.0, 0.0005). The fitted function is shown here. Since the fit was not good, is there a better function to fit this kind of data, or is there a better way to find the derivatives of the data?
View attachment 80813

View attachment 80813
Why not do some smoothing first? Numerical Recipes has some methods for doing this.
 
  • #3
Quantum Defect said:
Why not do some smoothing first? Numerical Recipes has some methods for doing this.
would smoothing the data give a clean first and second differential plot? If so which smoothing algorithm would work best? Since the data was originally plotted with time, would exponential smoothing work?
 
  • #4
gothloli said:
would smoothing the data give a clean first and second differential plot? If so which smoothing algorithm would work best? Since the data was originally plotted with time, would exponential smoothing work?

You have high frequency noise, with a very clean underlying signal. I would just try some different ways to smooth (moving window is easiest) and see what you get. It will get rid of the high frequency noise, and should clean up the derivatives.
 
  • #5
Actually each data point shown above, was an average of an even noisier data set. Since I changed the electron volts every 2 seconds, I took the average of the voltage every two seconds. So using moving average would make the data even more cleaner? Do you know any smoothing functions from numpy?
 

Related to What function should I fit to this data?

What is the best function to fit to my data?

The best function to fit to your data depends on the specific characteristics of your data and what you are trying to achieve. It is important to carefully analyze your data and consider different types of functions before deciding on the best fit.

How do I determine the appropriate function to fit to my data?

The appropriate function for your data can be determined through data analysis techniques such as visualizations, statistical tests, and mathematical modeling. It is important to consider the shape, trends, and patterns in your data when selecting a function.

What factors should I consider when choosing a function to fit to my data?

When choosing a function to fit to your data, you should consider the type of data (continuous, discrete, categorical), the relationship between the variables, the complexity of the function, and the interpretability of the results. It is also important to consider the assumptions and limitations of different functions.

Is it better to use a simple or complex function to fit my data?

The decision to use a simple or complex function depends on the complexity of the relationship between your variables and the purpose of your analysis. It is generally recommended to start with a simple function and then gradually increase the complexity if necessary. Using a complex function without justification can lead to overfitting and unreliable results.

Can I use a different function than the one recommended by the software?

Yes, you can use a different function than the one recommended by the software. However, it is important to carefully consider the appropriateness of the chosen function and justify your decision. It may also be helpful to compare the results of different functions to determine the best fit for your data.

Similar threads

  • Programming and Computer Science
Replies
9
Views
2K
  • STEM Educators and Teaching
Replies
5
Views
823
  • General Math
Replies
2
Views
752
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
940
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
28
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
26
Views
2K
  • General Math
Replies
19
Views
1K
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
Back
Top