LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

filtering a 1D array of data

Hi,

I have already asked a question about my problem quite some time ago, but I figured I had got everything wrong, so i created this new topic:

I have stored the data that I had acquired through DAQ and now I want to filter the data.

Capture.PNG

the data I need to filter is the one entering the BUILD WAVEFORM vi (NVB4 and NVB3 are data from DAQ). the sampling  rate is 10000 and the freq of the signal, of which I stored the data, was 90Hz. yet the output doesn't seem to be right, ( I want to use different LP and BP filters on it). please tell me if you know what i have done wrong.

thanks in advance

PS:I used .txt format to upload the files

Download All
0 Kudos
Message 1 of 11
(6,805 Views)
First of all, before we get to the filter, what in the world is that loop in the middle supposed to be doing? Appending all the rows into one long 1D array? There is a built-in function on the array palette that will do that for you (reorder array, I think).

In terms of the filter, what doesn't look right? Also, why use the express VI? There is a very simple low pass filter vi that you can be sure doesn't have any funny side-effects. Give it an array of data points, sample rate, and desired cut off, and you're done.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 11
(6,781 Views)

@mikeporter wrote:
There is a built-in function on the array palette that will do that for you (reorder array, I think).

Reshape array

 

 

Of course since the loop iteration numbers are hardwired and completely unrelated to the size of the 2D array, we don't know what you actually want. You might have to take an array subset first based on the constants wired to N to get the same result. 

Message 3 of 11
(6,763 Views)
Yup that's it. I knew it was re-something array.

Thanks Christian.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 11
(6,741 Views)

thanks for the vi. I didn't know there was such a vi. but about the filter and waveform: the output for the waveform is nothing like a sinusoidal waveform. so regardless of what filter I use, it doesn't work. I'm new to labview, so please forgive me if my problem seems stupid.

0 Kudos
Message 5 of 11
(6,708 Views)

The VI you have attached looks quite different to what you show in the picture. There is also a missing subVI (it is NOT a good idea to name subVI similar to built-in functions i.e. split 1D array). Please provide the subVI.

 

You seem to randomly use either graphs or charts, as if they serve the same function. Your loops for the ptbypt filters are overly complicated.  Instead of two shift registers, all you need is autoindexing. Try it.

Still it does not seem reasonable to use ptbypt routines if the entire array is available at once.

 

Please explain what kind of filtering you are trying to do.

 

 

 

0 Kudos
Message 6 of 11
(6,694 Views)

altenbach

sorry for the wrong attachment. The vi I had attached at first was something on which I tried a few things and I forgot to undo the changes( I made a lot of mistakes in it) , here is the one I'm working on (edited version of the first picture). And the pt by pt filters are for the sake of online filtering (since I'll be doing this for data coming from DAQ as well).  Also here's what the subvi does:

 c2.PNG

thank you for your time

 

Download All
0 Kudos
Message 7 of 11
(6,679 Views)
Again, this subVI is way over complicated -- thought no doubt is how you would approach the problem in other languages. As it turns out the same VI I recommended before (reshape array) might solve this problem as well. In addition to turning 2D arrays into 1D arrays, it also do the reverse and turn 1D arrays into 2D arrays.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 11
(6,663 Views)

@erfan6511 wrote:

Also here's what the subvi does:

 c2.PNG

 


 

Here's equivalent code of your subVI using reshape array... arguably simpler. 😄 

(there are a few other ways to do this. You can omit the "sign" and "add" if the number of points is guaranteed to be an integer multiple of the number of channels)

 

 

 

You still haven't explain what kind of "filtering" you are trying to do.

 

 

 

0 Kudos
Message 9 of 11
(6,653 Views)

again thank you for the help on the subVI,it really simplified the vi. but my problem is in making the waveform. here i can't create the waveform i should be recieving which is a sinusoidal waveform, and when I'm getting real time data, when I use lowpass filter with frequencies smaller than the signal, it still shows the original signal without any change. Is it not enough to make a waveform out of the array that I've acquired? 

if I still am not conveying my problem clearly,please tell me,I'll try my best to be more clear.

thanks

0 Kudos
Message 10 of 11
(6,644 Views)