LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

median filter.vi has strange results at egeds end of array

Hello all,

 

I have been trying to use the median filter.vi to do some testing.  I cannot seem to quite wrap my head around what it is doing at the eges of the data.  I have created a demo vi to show case 4 major behaviors.  A contious upward slope, a continous downward slope, an upward slope with one low point at the end and a downward slope wioth one high point at the end.

 

Please run the labView sample and help me figure out why this edge behavior seems so strange.

 

 

Download All
0 Kudos
Message 1 of 5
(3,113 Views)
The answer lies in the way the median filter works. A median filter operates by calculating an output datapoint value based on the values of the input point and one or more points on either side of it. At the start and end of a dataset you are missing the data that is on one side or the other. Hence, you have the same inherent problem at the beginning of the data but the internal logic does a better job of covering it up.

At the end of a dataset there is no completely correct way of handling the situation. You could just delete the last data point, or acquire extra data and then trim off the end points. Or you could try to make some sort of assumption about the data and extrapolate input data points you didn't collect.

A good reference is Tukey's book on Exploratory Data Analysis -- AKA "the red book".

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 5
(3,077 Views)

"Median Filtering.vi" is a nice shipping example of how this feature works.

 

GRANTED! the Example.vi would be impvoved by:

  • Deselecting "Autoscaling" of the "Y" axis
  • Expanding the "Plot Legend" to show which plots are shown in each color by name.

I'll mention that to people that could make that changeSmiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 5
(3,064 Views)

I understand that some decision has to be made at the edge of the array since it is impossible to carry the calculation past the dataset, and any decision will represent a tradoff.

 

My issue was with the way this behavior seemed to be inconsistent.  Changing the direction of the data, changes its behavior. This is surprising. I guess I simply can't rely on the endpoints to behave consistently.

 

 

James

 

0 Kudos
Message 4 of 5
(2,996 Views)
Surprising or not, what you say it true.

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 5 of 5
(2,983 Views)