can't fing notching filter
Show older comments
hi everyone! for some reason i don't have a notching filter in "filter designer". could someone say if maybe i don't have a needed version or some additional app? thank you in advance!
Answers (1)
Second, both FIR and IIR notch filters are straightforward to design in MATLAB.
A design for a FIR notch filter for 60 Hz mains interference is —
Fs = 250; % Use Correct Sampling Frequency (Must Be Greater Than 250 Hz)
fcomb = [55 59 61 64]-10;
mags = [1 0 1];
dev = [[0.5 0.1 0.5]];
[n,Wn,beta,ftype] = kaiserord(fcomb,mags,dev,Fs);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');
figure
freqz(hh, 1, 2^20, Fs)
set(subplot(2,1,1), 'XLim', [0 100]) % Zoom X-Axis
set(subplot(2,1,2), 'XLim', [0 100]) % Zoom X-Axis
Fn = Fs/2;
N = 2^14;
t = linspace(0, 100, N);
s = randn(size(t));
s_filt = filtfilt(hh, 1, s);
FTs = fft([s(:) s_filt(:)])/N;
Fv = linspace(0, 1, N/2+1)*Fn;
Iv = 1:numel(Fv);
figure
subplot(2,2,1)
plot(t, s)
grid
xlabel('t')
title('Original (Time Domain')
subplot(2,2,2)
plot(t, s_filt)
grid
xlabel('t')
title('Filtered (Time Domain')
subplot(2,2,3)
plot(Fv, abs(FTs(Iv,1))*2)
grid
xlabel('f')
title('Original (Frequency Domain)')
xlim([0 Fn])
subplot(2,2,4)
plot(Fv, abs(FTs(Iv,2))*2)
grid
xlabel('f')
title('Filtered (Frequency Domain)')
xlim([0 Fn])
.
Categories
Find more on 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!
