Hello, I'm looking for some help designing a highpass filter that uses a blackman window and has a cutoff frequency at 0.001Hz for an input signal sampled at 1Hz. I've tried playing around with designfilt(), but can't seem to get the magnitude response quite right. Any suggestions?

 Réponse acceptée

Star Strider
Star Strider le 20 Juin 2017

0 votes

There is no relevant documentation for designing with Blackman windows with fir1, or in my references.
This took a bit of experimentation to get to work:
Fs = 1;
Fn = Fs/2; % Nyquist Frequency
Fc = 0.001;
N = 120;
N = 2*fix(N/2);
wndw = blackman(N+1);
b = fir1(N, Fc/Fn, 'high', wndw);
figure(1)
freqz(b, 1, 2^17, Fs)
The filter order ‘N’ must be even, so I included a line that enforces that. Longer filters are more likely to match your requirements, however they are less efficient.

2 commentaires

Craig Kelley
Craig Kelley le 20 Juin 2017
Thanks a bunch.
Star Strider
Star Strider le 20 Juin 2017
My pleasure.

Connectez-vous pour commenter.

Plus de réponses (1)

Samuel Low
Samuel Low le 10 Avr 2018

0 votes

if true
clc; clear all;
fs = 10000; % Sampling frequency in Hz
Wp = 2000; % Passband frequency in Hz
Ws = 2500; % Stop band frequency in Hz
f = [Wp,Ws];
fStop = 0.5*(Wp+Ws)/fs;
dev = [0.005,0.005];
a = [1,0];
[n,Wn,beta,ftype] = kaiserord(f,a,dev,fs);
% We use the order estimated in kaiserord
BMWindow = blackman(n+1)
b = fir1(n,fStop,'high',BMWindow) % Normalise the frequencies
freqz(b,1,512)
title('Highpass Filter Design')
end
I determined the filter length using the Kaiser Order function (which determines what my filter length should be) but you can just set any arbitrary N that you like, it just happens to have this requirement for one of my assignments and I was lazy to change it. I then defined a Blackman window using the 'blackman' function, and used this window function as one of the arguments in the variable 'b'.
Hope this helps.

Community Treasure Hunt

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

Start Hunting!

Translated by