05-16-2022 08:34 AM
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.
05-16-2022 08:46 AM
hi,
you could use the following function (from the mathematic palette) :
05-16-2022 08:50 AM
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"?
05-16-2022 09:18 AM
thanks, I did not know the function "add array elements"
05-23-2022 12:11 PM - edited 05-23-2022 12:17 PM
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: