04-06-2011 05:54 PM
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.
Solved! Go to Solution.
04-06-2011 06:26 PM
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?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-06-2011 06:50 PM - edited 04-06-2011 06:51 PM
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?

04-06-2011 06:55 PM
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
04-06-2011 07:09 PM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-06-2011 07:23 PM
thanks a lot. that is exactly what I was looking for...
04-06-2011 07:28 PM
Thanks. This is what Christian showed nicely in the avove jpeg. file