From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate an equation from an XY graph

Solved!
Go to solution

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.

0 Kudos
Message 1 of 3
(2,561 Views)

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
0 Kudos
Message 2 of 3
(2,513 Views)
Solution
Accepted by aro1

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
0 Kudos
Message 3 of 3
(2,509 Views)