Fitting a curve in log-linear plot.

In summary, the conversation discusses fitting a curve through 6 points in a log-linear plot. The group suggests using interpolation rather than fitting and providing a parametric representation for the curve. Various methods for finding a curve through the points are discussed, such as using simultaneous equations or specifying desired values of the slope. It is also noted that the curve in the picture is not a function since some X values have two possible Y values. The group also questions the purpose of plotting in a lin-log plot and suggests using least-squares regression for finding a curve that does not pass through all the data points.
  • #1
mikewinifred
8
0
Hi all,

I want to fit a curve through 6 points (please see figure attached, the curve in the picture is a drawn one not a fitted one. That is just to give a feel how the fitted curve would look like.) in a log-linear plot. Is there any way I can do it? Thanks.
 

Attachments

  • logLinearFit.png
    logLinearFit.png
    5.1 KB · Views: 485
Mathematics news on Phys.org
  • #2
What sort of curve are you expecting?

The data in your example are so scattered it could almost probably a straight line! You would not normally assume the points represent the wigglyness of the curve in the way you just did.
 
  • #3
When you want a curve to go exactly through a number of points, this is called "interpolating" a curve rather than "fitting" a curve. An interesting thing about your problem is that, in the curve you drew, y is not a function of x. This suggests trying a parametric representation where x = f(t) and y = g(t).

I can't tell whether your goal is to find a "nice" formula for the curve that only involves a few multiplications and divisions or whether you would be satisfied with a curve that had several different sections, each with a different formula for it. An example of defining an interpolation curve in pieces is "spline" interpolation.


For a "one piece fit", you could try setting
[itex] f(t) = a_0 + a_1 t + a_2 t^2 + ...+a_5 t^5 [/itex]
[itex] g(t) = b_0 + b_1 t + b_2 t^2 + ...+b_5 t^5 [/itex]

where [itex] a_i, b_i [/itex] are unknown constants. Substituting the data points [itex] (x_k,y_k, t_k) [/itex] in those equations gives you a series of simultaneous equations to solve for [itex] a_i,b_i [/itex]. (You can make up the values of the [itex] t_k [/itex] anyway that satisifes [itex] t_1 < t_2 < ...t_6 [/itex].)

This is one way out of an infinite number of ways to find a curve through the points and the look of the curve you get this way not please you. To change the look of the curve you have to add more unknown coefficients. To get a unique answer for those coefficients you have to add more conditions. For example, you could pick points on the curve you drew by hand and add them to the data. Or you could specify desired values of the slope of the curve at various points.
 
  • #4
Looking at the picture, I have to agree with Stephen. That problem is called interpolation. Curve fitting means you try to find a function that is close to those points in the least squares sense.
 
  • #5
Thanks Stephen and others for the reply. Y is indeed a function of X. The only thing is X is in Log scale and Y is in linear scale. Yup am shooting for a nice formula, which will go through all the points. Since the horizontal axis is in Log scale , how it is going to affect the interpolated formula? Thanks.
 
  • #6
mikewinifred said:
Y is indeed a function of X.

Y is not a function of X as you drew the curve. There are some X values for which there are two possible Y values. That can't occur if you want Y to be a function of X.
 
  • #7
This is where, to properly advise you, we need to know what the data represents: what did you measure that you plotted to get that graph? Why were you plotting a lin-log plot - what was this supposed to achieve?

I suspect that your curve is not supposed to go through all the data points. That's quite unusual.

For instance - if your data is expected to come from a function of form:
[itex]y=y_0e^{\lambda x}[/itex]

and you measure y for set values of x

then if you plot the natural logarithm of y against x you get a line:
[itex]\ln|y| = \ln|y_0| + \lambda x[/itex]

... with slope and intercept that can be found by least-squares regression (or max/min estimates). The line you get this way is unlikely to pass through any of the data points - expected since the data points are known to be uncertain: they are measurements after all.

Examples:
http://facstaff.unca.edu/mcmcclur/class/LinearII/presentations/html/leastsquares.html
... covers polynomial interpolation through to curve fitting using MATLAB or gnu octave.
 
Last edited by a moderator:

What is a log-linear plot?

A log-linear plot is a type of graph where one axis is plotted on a logarithmic scale and the other axis is plotted on a linear scale. This allows for a better visualization of data that has a wide range of values.

Why would I need to fit a curve in a log-linear plot?

Fitting a curve in a log-linear plot allows for a better understanding of the relationship between the variables being plotted. It can also help identify any patterns or trends in the data.

How do I fit a curve in a log-linear plot?

To fit a curve in a log-linear plot, you can use a mathematical equation or a software program. The most common method is to use a linear regression model to find the line of best fit for the data.

What are the benefits of using a log-linear plot over a regular linear plot?

A log-linear plot can help to better visualize data that has a large range of values, as it compresses the data on the logarithmic axis. This can also help to identify any exponential relationships between variables. Additionally, a log-linear plot can make it easier to compare data points that are far apart on the logarithmic scale.

Are there any limitations to using a log-linear plot?

One limitation of using a log-linear plot is that it may not accurately represent the data if there are large variations in the data points. It can also be more difficult to interpret and compare data on a log scale compared to a linear scale. Additionally, a log-linear plot may not be suitable for all types of data and may require transformation to better visualize the relationship between variables.

Similar threads

  • General Math
Replies
12
Views
963
Replies
16
Views
2K
Replies
5
Views
466
  • General Math
Replies
9
Views
1K
  • General Math
Replies
2
Views
9K
  • General Math
Replies
22
Views
3K
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • General Math
Replies
15
Views
2K
Replies
1
Views
941
Back
Top