# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Slope of non linear curve

Hello all,

How can I get slope from any particular point from non linear curve? I am using Lev-Mar curve fitting as this is non-linear.  The slope is for determining the dynamic resistance of current-voltage curve of diode where dynamic resistance = 1/slope. Kindly help..

Message 1 of 24
(1,904 Views)

## Re: Slope of non linear curve

How old is this VI??? 😮 I recommend to use the modern nonlinear curve fit (you are using the quite dysfunctional pre-8.0 version with the default shipping model (i.e. single exponential with offset), which may or may not be appropriate). What is the correct nonlinear model for your data? Once you have the model, you can easily calculate the formula for the analytical derivative (slope). If it gets too complicated you can do numerical derivative.

LabVIEW Champion. It all comes together in GCentral
Message 2 of 24
(1,878 Views)

## Re: Slope of non linear curve

Hi

Please check the attached VI. Some of the vi's in your code is missing as the device drivers for your device is not on my PC. However i got an idea of what you were trying to implement.

Generally, the slope of a curve at a point is expressed as the slope of the Tangent to that curve at the selected point.

Tangent to the curve can found by calculating the derivative of the curve. So in simple words, the slope at any point is given by the value of derivative of the curve at that point.

Here are the steps to follow.

1. Find the derivative of the Best fit data.
2. Find the value of derivative at the point of interest, it will be the slope at that point.

I have created a vi for you.You can use the attached vi as a subVI i your progam.

Note: I have assumed that you have sampled your data at equal intervals of voltage

Best Regards

Deepu Jacob

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂

Message 3 of 24
(1,861 Views)

## Re: Slope of non linear curve

Hi djac91,

Thanks for your help! The solution was really helpful. I want to ask, dx(t)/ dt  in this case where dx(t) is dI (current) vs dt (voltage) , when running the program; the point of interest is what I give control on to get the slope, but how about dt? From your attached vi it shows that I should give input to dt too while running the program. Kindly correct me if i misunderstood

Message 4 of 24
(1,852 Views)

## Re: Slope of non linear curve

I connected your vi like this. What is the difference between input of  best fit (Y) and best fit data - current (mA) . As Y function is current.

Message 5 of 24
(1,845 Views)

## Re: Slope of non linear curve

Hi,

As per the attached image, your code is corect

1.  You are correct, Best Fit (Y) corresponds to your Fitted data (Current(mA)
2.  dX(t)/dt>>> correspoonds to dI(t)(current-ma) / dV(voltage) in your case
3.  similarly dt is dV in your case. Here dt, that i used is the sampling/step interval for your data. which means the voltage steps in which you have taken the measurements. Here i have assumed that you have the voltage values in equal steps. for example say 2v, 4v, 6v, 8v.etc ,thenthe dt(or dV) will be 2v since each steps has a difference of 2v from the next/prev step.

Now if your voltage values are in unequal steps, say like 2v , 5v, 7.5v etc. we have to use a slightly different method.

It will be really helpful ifyou could share the original data and best fit data as a file.

easiest way is to right click on the graph and select "Export>>Excel".

Regards

Deepu

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂

Message 6 of 24
(1,831 Views)

## Re: Slope of non linear curve

You are still not making a lot of sense!

Once you have the best fit, the best fit parameters, and the fitting model equation, all desired derived parameters such as slope at a certain point, etc. can be derived from the three fitting parameters analytically.

Read my first reply again! None of these convoluted suggestions are necessary. They just complicate the issues.

Do you have a link to a web page that describes the experiment, theory, and fitting model? Is a single exponential with offset really the right one?

Alternatively, you could just fit to a polynomial, where again the derivative is easy to calculate from the coefficients.

Also why do you incrementally fit the data with every iteration? Wouldn't it make more sense to wait until all data is acquired?

LabVIEW Champion. It all comes together in GCentral
Message 7 of 24
(1,787 Views)

## Re: Slope of non linear curve

Also why do you incrementally fit the data with every iteration? Wouldn't it make more sense to wait until all data is acquired?

Hi aidasaufi,

Christian is on point regarding waiting for entire data before taking the derivatives.

Once you have the best fit, the best fit parameters, and the fitting model equation, all desired derived parameters such as slope at a certain point, etc. can be derived from the three fitting parameters analytically.

Alternatively, you could just fit to a polynomial, where again the derivative is easy to calculate from the coefficients.

Christian,

if possible,can you please show this with a small example.

Best Regards

Deepu Jacob

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂

Message 8 of 24
(1,741 Views)

## Re: Slope of non linear curve

Correct, if all data has required it is much easier, I choose a certain point and the value of dynamic resistance is calculated. Attached is the file of IV curve experiment. Dynamic resistance is simply an incremental change of voltage/ incremental change of current. Can you show the connection if using polynomial and the slope value from it.

Message 9 of 24
(1,735 Views)

## Re: Slope of non linear curve

@djac91 wrote:

if possible,can you please show this with a small example.

Yes, if you show me a link with the correct theoretical model that describes the data. 😄

LabVIEW Champion. It all comes together in GCentral
Message 10 of 24
(1,709 Views)