12-06-2012 05:02 AM
How can I differentiate an array? When I connect the same array to the integral block it automatically understands it as a z(x,y) function. I cannot do the same with the derivative.
What should I do?
Thanks
Solved! Go to Solution.
12-06-2012 05:09 AM
In Numerical analysis differentitation means difference between two values devided by the difference in there position.
So try to take difference of two consecutation array values and devide it by index.
12-06-2012 09:17 AM
And the result will be exactly the same as if I differentiated my z(x,y) function by x?
And by which index I should divide it? If I take value A, with index 10, and value B with index 11, should I just subtract (A-B) and dide it by... 10,5?
12-06-2012 10:12 AM
What functions or VIs are you using? The only ones I see are for 1D arrays. Integrating or differentiating a 2D array requires specifying a path or direction through the array. Even in analytic mathematics these operations are usually done one dimension at a time.
Lynn
12-06-2012 10:20 AM
I need partial derivatives. My array is my Z(x,y) function and I need both dZ/dx and dZ/dy. I'm trying to use derivative x(t).vi and some solutions I found on the Web.
By specified path you mean that I have to add all raws of my array to make 1D array, and then differentiate, and then again the same with columns?
12-06-2012 10:26 AM
There are two basic integration functions (plus a few more).
Integral (x(t): takes a 1D array and outputs a 1D array corresponding to the running integral of the function.
This operation can be approximately reversed using the derivative x(t) function.
BOth only work for 1D arrays.
Numeric integration: Takes a 1D, 2D, or 3D array and returns a single scalar number, corresponding to the integral.
This operation cannot be reversed, because there are infinite possibilities to go from a single scalar to arrays.
12-06-2012 10:30 AM - edited 12-06-2012 10:34 AM
@Oficmajster wrote:
I need partial derivatives. My array is my Z(x,y) function and I need both dZ/dx and dZ/dy. I'm trying to use derivative x(t).vi and some solutions I found on the Web.
dZ/dx depends also on y and DZ/dy also depends on x. How do you want the output to look like?
What did you find "on the web"? Do you have a link? (this seems easy enough. Have you tried?)
12-06-2012 11:26 AM
I know the math principles. Look: say we have a function z(x,y) and we get 2 partial derivatives. Tells the story. My problem is that don't have the function as a formula, I have an 2D array. So I need either to differentiate (somehow) the array, or change it (somehow) into the formula and then proceed. I know about integrals, for I used them in my program previously, now I need partial derivatives.
Thanks for your responses, by the way 🙂
12-06-2012 11:39 AM
For example at y = 6 you get a 1D array of z(x). Differentiate that. Repeat for y = 7... Then for each x calculate dz/dy. With for loops and autoindexing this can be quite straighforward.
Lynn
12-06-2012 11:45 AM
As a first approximation, you could take the difference of adjacent values. Your output array would be a complex array where, for each x,y position, the real part is dz/dx and the imaginary part is dz/dy.
.