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.

Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

Median filter is not removing the bottom spikes

Solved!
Go to solution

Hi all

I am using a median filter to removes spikes for real-time thickness data acquisition from an ultrasonic sensor. This filter is working fine to remove the upper spikes, unfortunately the bottom spikes remains unchanged. I tried by changing different rank in the median filter with no improvements.

The attached pictures are LabView code and the graphs showing data before and after filtering. How could I remove these bottom spikes also?

Thanks in advance

Apple

 

 

Download All
0 Kudos
Message 1 of 8
(6,229 Views)

Instead of posting a pic of your graphs, post the vi with the data (edit-make current values default, file-save)

I hate guessing vom pictures if the data is there to do a quick test.

The median filter should do the job ....

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 8
(6,213 Views)

Dear Henrik

I tried to save data by the technique (edit-make current values default, file-save). Unfortunately I could not save them.

Here is the vi and saved data ( for the both wavefrom chart) in excel.

Gritting from Canada

Apple

0 Kudos
Message 3 of 8
(6,193 Views)
Solution
Accepted by topic author applebuet

I believe that your problem is your acquisition code, not the filter. The data set you posted has 969 elements with values of 2.681 or 2.68. The other 54 elements have values like 2.6, 681, 1, 2, 8,  and 68. One element has the value 5 and one has the value 9.

 

What this suggests to me is that your VISA Read is not properly synchronized with the device transmitting the data. Either you are getting partial messages or an occasional character which does not fit your regular expression.  Look at the default value saved in read string in your VI. Swithc the display to '\' Characters mode. It contains "\D5U=\F32.681\r\n2.681\r\n2.681\r\n" This looks like it has two special characters \D5 and \F3 and then three values separated by carriage return, line feed. With this kind of protocol you should probably be using the default line feed as a termination character. Then search for the \D2...\F2 string which may be a header or channel ID. The rest is numeric data.

 

Check with the creator of the device which is sending this data to determine the complete communication protocol.

 

Lynn

0 Kudos
Message 4 of 8
(6,181 Views)

here is a mod of your vi, run it to store some raw data

post that data and we should be able to help you with the decoding 🙂

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 8
(6,167 Views)

Since there was a slice of data in the read string 😉

Here is a quick try for decoding:

Looks like the data contain \r\n after each data send, so I enabled the terminal character.

Data send as floating point with a point as decimal seperator, so I tried with scan from string with a "%.;%f"

 

And it seems that you run that vi in contious mode ... not good, you will loose data and reinit and close the COM port on every read...

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 6 of 8
(6,164 Views)

Dear Henrik

Thank you for doing codes for me. I am using 2011 version, I asked the department to install 2012, and I hope they will do it ASAP. Whenever I get 2012 version I will be able to open you program. And then I will see how does your program could be helpful for me.

Greetings from Canada again.

Apple

0 Kudos
Message 7 of 8
(6,143 Views)

here is a 2011 version

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 8 of 8
(6,137 Views)