I would like to calculate the integral of a function (I have the array with the values), with the rectangle method. How can I do?
alternatively, being dt = 1, I could calculate the sum of all the elements of the array, but with the for loop it is too slow.
How could I do? Thanks,
S.
Solved! Go to Solution.
hi,
you could use the following function (from the mathematic palette) :
Hi nept,
@nept wrote:
I could calculate the sum of all the elements of the array, but with the for loop it is too slow.
Why do you need a FOR loop to calculate the sum of an array? (Ever heard of ArraySum function?)
And what exactly means "too slow"?
thanks, I did not know the function "add array elements"
If "add array elements" is fast enough, it is unlikely that using a FOR loop is too slow unless you are doing something terribly wrong (are you for example pumping the sum across iterations with value property nodes???). FOR loops (and shift register) are one of the most efficient structures. Can you show us what you did to make things "too slow" so we can help you improve your LabVIEW skills?
I seriously doubt that you would notice a performance difference between the following two version: