From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a formula

Solved!
Go to solution

Generating the Formula of selected values with this logic!

 

 

  1. Create 1-D Array with 10 elements with AI voltage, DAQ, a0,a1,,,,a9
  2. Select the sampling time with t0,t1, t2…..t10
  3. t0  t1  t2  t3  t4  t5  t6  t7  t8  t9  t10  t11  t12  t13........t100sample time

a0  a1  a2 a3 a4  a5  a6  a7  a8  a9  a9  a11  a12  a13…….a100  values

  1. Farmula

A5^=Summation (a2+a3+a4)-Summation(a6+a7+a8) /100

 

  1. A6^=Summation(a3+a4+a5)-Summation(a7+a8+a9)/100

If “i” is the number of data values:

  1. Ai^=Summation(ai-3+ai-2+ai-1)-Summation(ai+1+ai+2+ai+3)/100
0 Kudos
Message 1 of 12
(3,285 Views)

For loops, Index array, Array subset, Array sum and division.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 12
(3,280 Views)

Thank you for the reply!

Please see the VI attached.

In my VI I calculate A6^ value only how can I use the formula for many values or generalize it?

0 Kudos
Message 3 of 12
(3,274 Views)

I have tried two methods now, in my new VI.

1. If I am using a large data set I do not have to choose the value with index array everytime

 for the value in concern it automatically:

takes the summation of first values of the current minus the summation of next three values, divide by 100

2. Is there any simple way?

Please see the attached!

0 Kudos
Message 4 of 12
(3,266 Views)

Good start. Now you can add an Index-control to control your A[i]. The first element of the Index array will be i-3 and the 4th i+1, the others dont need any inputs as they per default will be [previous+1].

 

If you want the answer as an array you'll just need to wire your restlt to the for loop border.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 12
(3,263 Views)

How can I introduce index? Please can you modify my VI and show.

0 Kudos
Message 6 of 12
(3,258 Views)

Minor modification to your 3rd loop/try.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 12
(3,250 Views)

Sorry can you send the modification in LV2009.

0 Kudos
Message 8 of 12
(3,225 Views)

2009 version

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 9 of 12
(3,217 Views)

Thanks!

0 Kudos
Message 10 of 12
(3,211 Views)