06-26-2018 06:29 PM
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;
06-26-2018 06:36 PM
You could use a recursive VI 🙂
06-28-2018 08:00 AM
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.