Azzera filtri
Azzera filtri

how to design bandpass filter with cut off wavelengths given.

6 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Star Strider
Star Strider il 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 Commenti
math seeker
math seeker il 26 Feb 2018
The line
freqz(sos, 2^16, Fs)
gives me an error.
error: freqz: B must be a vector
Star Strider
Star Strider il 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.

Accedi per commentare.

Più risposte (1)

Abhishek Ballaney
Abhishek Ballaney il 22 Feb 2018
https://in.mathworks.com/help/signal/ref/butter.html

Community Treasure Hunt

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

Start Hunting!

Translated by