how to filter quantization uncertainty

1 view (last 30 days)
peter schwöger
peter schwöger on 21 Oct 2015
Edited: peter schwöger on 21 Oct 2015
what is the best option to filter data with quantization uncertainty.if the curve bounces between two values before an edge. what I want is to have the mean of upper and lower value, which is not possible with med1 median filter, because the median of e.g. 99*upper value + 100*lower value is lower value and not the mean. what filter returns the mean while preserving sharp edges?
thanks for your help!

Answers (1)

Star Strider
Star Strider on 21 Oct 2015
Assuming I understand your Question, I would use a moving average filter. Experiment with the length to get the result you want:
s = [5 + randi([0 1], 1, 20) 4:-1:0]; % Create Data
t = 0:length(s)-1;
N = 4; % Filter Length
b = ones(1,N);
a = N;
sf = filtfilt(b, a, s);
figure(1)
plot(t, s)
hold on
plot(t, sf)
hold off
grid
axis([xlim 0 10])

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!