MATLAB Answers

0

is there a bandwidth limit on the bandstop filter

Asked by STEPHEN BARRETT on 12 Jun 2019
Latest activity Commented on by Star Strider
on 14 Jun 2019
I have the following code which is stopping a super narrow band on a signal. It runs but won't complete and locks up matlab. I assume becasue I'm pushing the filter past it's limit. Can anyone confirm this?
y = bandstop(signal, [4500 950000], 5e9);
Thanks

  4 Comments

Show 1 older comment
On my system, with 4 CPUs, that runs 4 threads (automatically) doing the calculation. The amount of memory involved is not much comparatively -- the entire MATLAB process is sitting at less than 1.5 gigabytes including the desktop.
I ran 1 million earlier and it took a bit but finished. I am timing 10M now.
970.3 seconds for 10M on my system.

Sign in to comment.

Tags

1 Answer

Answer by Star Strider
on 12 Jun 2019
 Accepted Answer

The easiest way to see what’s going on with it is to use fvtool to look at it, and to give it a short random signal to look at the output:
signal = rand(1, 1E+4);
[y,df] = bandstop(signal, [4500 950000], 5e9);
fvtool(df)
figure
plot(y)
It appears to be a well-designed filter, and works with a random signal. I suspect that something about your ‘signal’ vector could be part of the problem, possibly its amplitude, since the output of the random signal (with an amplitude between 0 and 1) produces an output on the order of . The normalised frequency of the stopband center frequency is about . (In my experience, this is a bit extreme.)
In situations like this, it’s sometimes worthwhile to design both a lowpass filter and a highpass filter, and then add the output vectors. (There is no way to cascade them, since the output of one filter will not overlap with the output of the other filter.)
The problem does not appear to be with the filter itself, since the fvtool analysis suggests that it’s stable and works well.

  10 Comments

I wasn’t certain what you intended by ‘noise’. In any event, nothing else changes. The ‘comb’ filter may do what you want. I would also experiment with wavelet denoising if you have the Wavelet Toolbox. See Denoising Signals and Images (link).
The denoising works quite well, although I have to admit I don't really know what it's actually doing. It also decreases the peaks height much more than the amplitude of the actual noise in the flat sections. So I'm not really sure how much of my actual signal is getting filtered out too.
tim.png
Part of the problem is that wavelets will find it difficult to differentiate completely the spikes from the noise unless you tell them to. That’s simply the nature of wavelets. I¹ve not worked with wavelets in a while (I would have to back and review my wavelet references), however concentrating on the higher-frequency wavelets (that would eliminate the noise) might be worthwhile, and would not attenuate the low-frequency parts of your signal (spikes). For this, you would use wavelet filters.

Sign in to comment.