# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

## Generate an equation from an XY graph

Hi

Does anyone know how to generate an equation from an XY graph. I had a set of data, generated an interpolated plot of the data set, and my curve/pattern is logarithmic. Though I would like to get the equation of the curve, the info i am really after are the Slope and Bias of the equation. This is the format I think the equation would be in: y = (Slope)*ln(x) + Bias. Any assistance is greatly appreciated. Thanks in advance.

Message 1 of 3
(725 Views)

## Re: Generate an equation from an XY graph

Hi AR_Odusanya,

As far as a simple XY graph goes I'm not aware of a way to  generate an equation based off the data since it is just a simple indicator. Are you able to post your code?

David H.
National Instruments
Message 2 of 3
(677 Views)
Solution
Accepted by topic author aro1

## Re: Generate an equation from an XY graph

Trying to run a log fit to Y = m ln(x) + c is no different to running a linear fit on Y = m x' + c, where x' = ln(x).

Still, you can do this two ways:

Logarithm fit for a sequence of X and Y will return amplitude and scale.

Consider Y = a ln(bx). We know from simple logarithms that ln(bx) can be expanded to ln(b)+ln(x)

So Y = a ( ln(b) + ln(x) )

Rearranging, Y = a ln(x) + a ln(b) (equivalent to your slope and bias expression)

where a is equal to 'amplitude' and b is equal to 'scale'.

Linear fit for a sequence of X = ln(x) will return slope and intercept.

Consider Y = m ln(x) + c = m X + c

The slope output is m, the intercept is c.

---
CLA
Message 3 of 3
(673 Views)