LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the structure of solving recursive summation in labVIEW

Highlighted

Hi, 

Can anyone suggest the correct structure of how to solve recursive equations in LabVIEW?

For instance, I would like to calculate the coefficients of g matrix [g_0,g_1,...,g_n]

which can be defined by : please see the attached photo.

 

Note that g_0=1;

Ameer 

 

 

 

 

0 Kudos
Message 1 of 3
(623 Views)
Highlighted

You could use a recursive VI 🙂

0 Kudos
Message 2 of 3
(621 Views)
Highlighted

The most straight-forward (but sometimes programmatically challenging) way to solve a recursive problem is, as gregoryj points out, to use a recursive algorithm.  In LabVIEW, you do this by making your VI "reentrant".

 

However, another method that can be a little easier for some problems is to try to transform the recursive problem into an iterative one, as iteration (a.k.a. "looping") is something most languages (including LabVIEW) supports quite well.

 

Here your best tools are Pencil and Paper.  Write down explicitly the formulas for g0, g1, g2, and g3.  Notice that each formula can be expressed as a summation between another array, v, the elements of the previously-generated elements of g, and some coefficients that depend on the specific index of g being generated.  The only "trick" is that you use the elements of the g array in the opposite order of the elements in the g array, but that's just an "indexing" problem.  So an iterative solution to generating, say, N elements of g from N elements of v should be simple to code in LabVIEW once you "see" the iterative pattern.

 

Bob Schor

0 Kudos
Message 3 of 3
(556 Views)