LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slope of non linear curve

Solved!
Go to solution
Highlighted

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..

0 Kudos
Message 1 of 24
(1,903 Views)

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 GCentral
0 Kudos
Message 2 of 24
(1,877 Views)

Hi aidasaufi,

 

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 🙂


0 Kudos
Message 3 of 24
(1,860 Views)

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

0 Kudos
Message 4 of 24
(1,851 Views)

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. 

0 Kudos
Message 5 of 24
(1,844 Views)

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 🙂


0 Kudos
Message 6 of 24
(1,830 Views)

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 GCentral
0 Kudos
Message 7 of 24
(1,786 Views)

 

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 🙂


0 Kudos
Message 8 of 24
(1,740 Views)

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.

0 Kudos
Message 9 of 24
(1,734 Views)

@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 GCentral
0 Kudos
Message 10 of 24
(1,708 Views)