LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I put this into a loop?

I'm running a convolution process on a large data file in segments. the algorithm that LabVIEW uses to do 1D convolution results in some clean-up being neccesary.

 

Suppose you run a convolution of the integers from 1 to 12 {1, 2, 3,...12} with wavelet {1,0,0,-1} the result is {1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -10, -11, -12} a 1D array with 15 values instead of 12 (number of values added = size of wavelet -1).

 

 

 

If I continued the convolution with 13-24, I get {13, 14, 15, 3, 3, 3, ... etc}  3 additional values again, but the 2 segments can be combined to give the convolution of 1-24. the last 3 terms of the first should be combined with the first 3 terms of the second.

 

i.e. {13, 14, 15} + {-10, -11, -12} = {3, 3, 3} which preserves the accuracy

 

In my program, I am taking in data 1000 samples at a  time from a source of large size (approx 2m values) and you can see how I cant have weird spikes every 1000 samples.

 

 

 

I've written a model for what I want to do, but have no idea how to put it into a loop. It is designed to split off a number of terms at the beginning and end of an iteration equal to the number of terms in the wavelet minus 1. Then it adds these chunks together and rebuilds an array from all 3 streams. Please take a look at the VI, because it is unfeasable to construct N different suboperations like this depending on my file size.

 

Thanks for the help.

 

Also, Sorry If I was incorrect in creating a new topic for this, I dont think the problem relates much to my earlier ones:

 

 

 

http://forums.ni.com/t5/LabVIEW/How-do-I-get-a-For-loop-to-display-the-results-of-each-iteration/td-...

 

http://forums.ni.com/t5/LabVIEW/Need-some-help-with-Convolution/td-p/1160795

 

0 Kudos
Message 1 of 13
(3,554 Views)

bump

0 Kudos
Message 2 of 13
(3,520 Views)

Here is the progress I have made so far,

 

I thought I might do better putting a loop inside a loop. However I dont seem to be getting my results.

 

Essentially, the process takes array A and array B (which are segments of the same original array which have been convoluted) and combines them to Array AB, I then need array AB to go through the same process only AB is the new A and C is the new B. this is the part where I get stuck,

 

Thanks for the help.

Download All
0 Kudos
Message 3 of 13
(3,492 Views)

I don't understand what it is you are trying to do, and its been way too long since I knew anything about Convolution, otherwise I would help.

Maybe you could try to explain better, and define your array constants in your block diagram.  After defining the constant, make it the default value.  Or change it to a control and make default values.

 

- tbob

Inventor of the WORM Global
Message 4 of 13
(3,464 Views)

As i understand something like this is what you're after.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
Message 5 of 13
(3,451 Views)

Sorry, I'll try to explain better.

 

The operation I do requires splitting off the end of one array, splitting off the beginning of another array, adding the 2 (equal length) segments together, and then rebuilding all 3 subarrays into an array again.

 

 

I've figured out how to loop this, but now i'm missing the initialization junk that's supposed to be at the beginning.

 

any suggestions?

 

I've included a picture to explain what's going on. Convolution creates some junk data at the boundaries, if the boundaries are aritificial, then the junk data from the beginning and end of 2 sequential convolutions can be added together to yield the convolution of the full sequence originally.

Download All
0 Kudos
Message 6 of 13
(3,448 Views)

Did you check my vi? I took your 1-12 and 13-24 arrays and convolute them and i return the summarized array. If you read chunks from a file it's a very minor change from my 2d array.

 

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
Message 7 of 13
(3,444 Views)

Sorry, Can someone repost that file for Labview 8.6?

0 Kudos
Message 8 of 13
(3,438 Views)

That should be 8.6

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

Qestit Systems
Certified-LabVIEW-Developer
Message 9 of 13
(3,436 Views)

That appears to be functional, but will unfortunately not work out for me, I run into memory problems when I deal with 2D arrays extensively.

 

I have solved my original problem of how to loop the operation. I am having implementation trouble however. Here are 2 VI's  that I have been trying to combine. nterms5.vi is complete and functional, no matter how many data are read in at a time, there are no boundary issues that arise from chunking.

 

When i try to plug that into the other VI, which includes a Decimation as well, boundary and chunking issues become significant again.

 

The process I want to do is this:

1. Read N values from the File (N= somewhere from 100-1000)

2. Convolve the chunks with wavelet of 6+ coefficients and reconstruct using the process given in nterms5.vi  (Send this outside the stuctures and graph it)

3. Downsample by 2 (decimate)

4. Repeat Steps 2 and 3, up to 4 times (For loop with N = 4?) Send the 2D stream from this, index, and graph each iteration

 

 

Relatively simple right? But I dont know what kind of loops to put inside what kind of loops and what ought to be tunnels or shift registers or if the shift registers need to be initialized. I've amassed almost all of the neccesary components now, some help with the synthesis would be a godsend.

 

if you run the help.vi file with the sample data, and change the number of incoming samples at a time from 1000 to 200 to 50, you can clearly see what i mean by my boundary condition.

 

Thanks much

Download All
0 Kudos
Message 10 of 13
(3,415 Views)