LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Derivative of arrays

Solved!
Go to solution

Hi,

 

I am new to labview and this question might seem trivial to you.

 

Here is what I am trying to do:

 

I have two arrays (generated via for loops).  I want to calculate the derivative of array 1 with respect to array 2 and then plot the resulting array vs array 2.

 

My VI (attached) does not do what I am trying to do.

 

Please help.

 

0 Kudos
Message 1 of 7
(10,758 Views)

It's hard to tell what you are trying to do.  You gave no defaults for C and C2, so I entered 20 and 30.

 

You threshold the B array at 70 to get a value of 6 (that means that value 70 should be at index 6 in the table, which it is).

 

You're then using 6 as the dT input to the derivative function.

 

What do you expect to see and what do you see that's wrong?

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 7
(10,750 Views)
Solution
Accepted by efi

The dt is typically the difference between the x-values (function assumes that the x-values are equally spaced, which they are). So, to get dt, simply thake the difference between any two adjacent x-values.

 

All you need is a single loop, right? The formula node seem overkill, for example the division by two should be done once before the loop.

 

Here's how you could simplify... makes sense?

 

Message 3 of 7
(10,744 Views)

Sorry for not being clear.  Do not pay attaention to the numbers I used, they are just for example.  The problem I have is general; I want to get the derivative of one array with respect to another one.    

In particular, I want to generate array A and B (as I did via forloop), get dA/dB and plot dA/dB vs B. 

 

I am guessing I might even have used a wrong function for derivative... please advise

0 Kudos
Message 4 of 7
(10,741 Views)

get dA/dB and plot dA/dB vs B. 

 

 

OK, here's where you lost me. Usually you get the derivative with respect to a CONSTANT, not another signal.  dT = sampling rate is a common one.  

 

If what you want is truly dA / dB, then delete one element from array A, subtract the original array from the shortened array (that calculates A[1] - A[0], A[2]-A[1}, and so on: an array of delta-A).

Do the same thing for the B array. to get deltaB

 

Divide deltaA by delta B.


Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 7
(10,736 Views)

thanks a lot. that is exactly what I was looking for...

0 Kudos
Message 6 of 7
(10,733 Views)

Thanks. This is what Christian showed nicely in the avove jpeg. file

0 Kudos
Message 7 of 7
(10,728 Views)