how to design bandpass filter with cut off wavelengths given.
8 views (last 30 days)
Show older comments
math seeker
on 22 Feb 2018
Commented: Star Strider
on 26 Feb 2018
I have a gridded bathymetry data. I have to remove all signals from the data with a wavelength greater than 4000 km and less than 400 km. How can I design a bandpass filter, eg. Butterworth filter? how do I determine the cut off frequencies and order of the filter? the spacing between grid points is 0.16 km.
0 Comments
Accepted Answer
Star Strider
on 22 Feb 2018
This will work for a filter design:
Ts = 0.16; % Sampling Interval (Units: km)
Fs = 1/Ts; % Sampling Frequency (Units: 1/km)
Fn = Fs/2; % Nyquist Frequency
Freq1 = 1/4000; % Convert Wavelentgh To Frequency (Units: 1/km)
Freq2 = 1/400; % Convert Wavelentgh To Frequency (Units: 1/km)
Wp = [Freq1 Freq2]/Fn; % Passband Frequencies (Normalised)
Ws = Wp.*[0.8 1.2]; % Stopband Frequencies (Normalised)
Rp = 1; % Passband Ripple
Rs = 50; % Stopband Ripple
[n,Wn] = buttord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = butter(n,Wn); % Calculate Filter
[sos,g] = zp2sos(z,p,k); % Convert To Second-Order-Section
figure(1)
freqz(sos, 2^16, Fs) % Filter Bode Plot
set(subplot(2,1,1), 'XLim',[0 0.05])
set(subplot(2,1,2), 'XLim',[0 0.05])
The Bode plot of the filter amplitude appears to have strange units, with the filter appearing to ‘amplify’ the signal. This is due to the way freqz calculates filter gain, not the design of the filter. The filter will not amplify your signal.
I leave the implementation to you, because I have no idea what you are doing.
4 Comments
Star Strider
on 26 Feb 2018
The code in my Answer runs without errors in R2017b. (I copied it from my post and ran it again just now, to be sure.)
I have no idea what your problem could be, since you only posted the freqz call.
More Answers (1)
See Also
Categories
Find more on Digital Filter Analysis 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!