LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

perform an y= a*exp(-b*x) regression

Hi everybody!

 

I was wondering if you migth help me with an issue.

I want to perform an exponential fit, but my curve has, approximately, this form y=a*exp(-b*x), which is a temperature vs time graph.

I need to calculate a and b, i tried with the exponential fit .vi, but the form of the curve is a decreasing exponential curve, while mine is an increasing exponential curve approximating up to a max level.

I attached an image for a better understanding.

Thanks in advance

 

p/ working with labview 8.2

0 Kudos
Message 1 of 10
(6,900 Views)
have you tried using the MathScript node?
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 2 of 10
(6,898 Views)

You could invert your curve first to make it a decreasing exp before applying the curve fitting function.

 

Cheers,

 

Battler.

0 Kudos
Message 3 of 10
(6,884 Views)
The curve you show has the form y = a(1 - exp(-b*x)), pretty easy for the nonlinear curve fit.
0 Kudos
Message 4 of 10
(6,876 Views)

Thanks for all  your help.

 

 In fact, you´re rigth, my curve has the 1- [exp(-b*x)] form.

About using the non-linear curve fit .vi; seems complex to me, i'm not familiar with this .vi

By the way, which coefficients should i use, is there any other thing that i should consider?

 

Inverting the signal did not give me the results i expected.

 

Thanks for your ideas, wating for your next comments

 

0 Kudos
Message 5 of 10
(6,852 Views)

It really isn't too hard to use the nonlinear fit VI.  Here are the steps.

 

Write a VI to generate the function values (and I like to calculate the derivates when possible).  There is a template VI to make this easier, or just use the example I post below as a starting point for future fits.  In harder problems, you can use the output control to only calculate derivatives when required and pass parameters using the variant data.  Don't even worry about that now.

 

Place the LM VI on a block diagram and select f(x,a) is a VI.  Open a reference to the VI you wrote for f(x,a) and pass it to the LM VI along with the X and Y data.  Create some initial guesses and fit away.  In this case, a is the value approached for large x and 1/b is roughly the distance required to reach 2/3 of the final value.  Your guesses don't need to be very precise.

 

That is all there is to it.  I assume the f(x,a) VI is in the same directory as the FitExponentialExample2.vi.

 

 

Download All
0 Kudos
Message 6 of 10
(6,803 Views)

Thanks Darin.K.

Can you post it for Labview 8.2, couldn't open the vi's

I want to give it a try

0 Kudos
Message 7 of 10
(6,786 Views)
Here it is in LV8.2.  I got a couple of warnings, hope it still works.
Download All
0 Kudos
Message 8 of 10
(6,777 Views)

I think there is an error in the ExponentialFunction.vi. The partial derivative of the function f(x,a,b)=a(1-exp(-bx)) with respect to b is a*x*exp(-b*x). The wire into the compound arithmetic function should origin in X instead of b (=a(1). I hope I have understood correctly partial derivatives and that is what is expected into f'(A,a).

0 Kudos
Message 9 of 10
(6,004 Views)

You are correct.

0 Kudos
Message 10 of 10
(5,998 Views)