LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tangent for an exponential function

Solved!
Go to solution

I have data as shown below.
I would like to use Labview to get the tangent in the point where Y =2.
Is there any way to do this?Capture.PNG

0 Kudos
Message 1 of 13
(4,359 Views)
Solution
Accepted by topic author Michael.Koppelgaard
  1. You have got the exponential function coefficients, so you got the equation: y = 9.8659 * exp(-1.27*x).
  2. Using the above function, first calculate the x value at the required y-position: (ln(9.8659)-ln(2))/1.27 = 1.25664...
  3. So you want to find the tangent at point (X_0; Y_0) = (2; 1.25664).
  4. Take the first derivative of the function, and calculate its value at "X_0". This gives you the slope of the tangent line: "m".
  5. Use the line equation: Y - Y_0 = m* (X - X_0) 

edit: i made a mistake, just swap the X_0 and Y_0 !

 

EDIT2: so to clarify:

  1. find the tangent at point (X_0; Y_0) = (1.25664 ; 2)
  2. The first derivative of the function is: y' = (9.8659/-1.27) * exp ( - 1.27 * x )
  3. Calculate the first derivative's value at X_0 --> you get the slope "m", m = - 1.5748
  4. Using the line equation, we get the tangent: y = -1.5748*x + 3.9789

Using LabVIEW, you can get the coefficients, and also can get the coefficients for the derivative. After that just simple math to find tangent at a certain point.

 

Message 2 of 13
(4,318 Views)

Or you try one of the Derivate functions and they should give you a good approximation, if it's only the answer you're after.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 3 of 13
(4,313 Views)

Actually, the only data I’m interested in, is the slope of the tangent in this point.

In order to get the fit, I used exponential fit, hoping I would get the expression of the curve as I did it in the in excel (image).

The derivation function you talked about, where do I find it, and how to use it?

 

 

code.png

0 Kudos
Message 4 of 13
(4,294 Views)

Derivative x(t) under mathematics ==> Integration & differentiation.

I haven't tried it, but the help and the linked example (in the help) looks good.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 13
(4,288 Views)

The exponential fit outputs the "amplitude" and "damping" (and "offset", but you currently force the offset to be zero). These are the two parameters that define the best fit and you can analytically calculate the derivative instantly for any desired X. This is the correct way.

 

(Doing numerical methods, such as the mentioned derivative function will not give you anything accurate)

Message 6 of 13
(4,267 Views)

Hi Blokk
Thank you for your very fine explanation

Using your calculation of the tangent seems to give at wrong result ?

 

Capture.PNG

 

Are you sure the derivative is correct ?
I get the derivative: a*b*exp(b*x). Don’t know if that correct?

 

 

 

 

0 Kudos
Message 7 of 13
(4,246 Views)

Michael.Koppelgaard wrote:

I get the derivative: a*b*exp(b*x).

 


That's what wolfram alpha says. 😉

0 Kudos
Message 8 of 13
(4,236 Views)
Solution
Accepted by topic author Michael.Koppelgaard

That is correct, the division was my mistake. When you derivate this, you need to multiply with the derivative of the internal function.

0 Kudos
Message 9 of 13
(4,233 Views)
0 Kudos
Message 10 of 13
(4,231 Views)