Gibbs-like behaviour with lowpass on long signals
Show older comments
I have a signal that is 1000 some data points sampled at a rate of 1/3 hz. I'd like to lowpass it with fpass = 0.08.
I have an example attached the first 196 of them:
t=readtable('example_signal.txt');
filtered=lowpass(t.Var1,0.08,1/3);
plot(filtered)
But this gives something that looks like gibbs!
t=readtable('example_signal.txt');
filtered=lowpass(t.Var1([1:178]),0.08,1/3);
plot(filtered)
And this doesn't?
Why does making the signal shorter change things? If I increase steepness, I can avoid this, but if the signal is longer yet again, I need to keep increasing steepness, which I can only do so much of -- and I can't make it steep enough to do the whole 1k long signal without an issue.
filtered=lowpass(t.Var1,0.08,1/3,'Steepness',0.9);
plot(filtered)
My guess is that as the signal lengthens, some part of the Fourier transform of it is getting pushed into the transition band, and that's why making it steeper helps.
But I don't know why it's happening, or how to avoid it.
If I knew how to calculate when this would happen, then I could just break my signal into parts shorter than this critical threshold. But I don't understand why that should help theoretically (indeed, it seems like I'd be throwing out information on very slow oscillations (which should pass anyways) if I were to do that).
Accepted Answer
More Answers (1)
Hi qfn,
I think that lowpass, et. al. will result in transients due the large, effective steps at the endpoints.
I think this issue (or something like it) is dicussed in the documentation or in other threads here on Answers, though I can't find either at the moment.
In any event, for this particular data set, subtracting the mean -> lowpass -> add the mean seems to work pretty well:
T=readtable('example_signal.txt');
x = T.Var1;
Fs = 1/3;
t = (0:numel(x)-1)/Fs;
[xf1,d] = lowpass(x,0.08,Fs); % original
xf2 = lowpass(x-mean(x),0.08,Fs) + mean(x);
figure
plot(t,x,t,xf1*nan,t,xf2),grid % removed xf1 for clarity
Categories
Find more on Frequency Transformations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






