LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array derivative

Solved!
Go to solution

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

0 Kudos
Message 1 of 19
(5,637 Views)

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.

Labview user
0 Kudos
Message 2 of 19
(5,634 Views)

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?

0 Kudos
Message 3 of 19
(5,612 Views)

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

0 Kudos
Message 4 of 19
(5,592 Views)

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?

0 Kudos
Message 5 of 19
(5,588 Views)

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.

 

 

0 Kudos
Message 6 of 19
(5,584 Views)

@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?)

0 Kudos
Message 7 of 19
(5,582 Views)

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 🙂

0 Kudos
Message 8 of 19
(5,566 Views)

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

0 Kudos
Message 9 of 19
(5,562 Views)

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.

.

0 Kudos
Message 10 of 19
(5,561 Views)