Zero phase filtering of FIR from filter and Analysis Toolbox

3 次查看(过去 30 天)
How can i use filtfilt function in this filter
% MATLAB Code
% Generated by MATLAB(R) 8.2 and the Signal Processing Toolbox 6.20.
% Generated on: 18-Mar-2019 12:11:31
% Equiripple Lowpass filter designed using the FIRPM function.
% All frequency values are in Hz.
data = xlsread('Smoothendata2.xlsx',1);% read csv content
d1 = data(:,1); % Original Time Vector
d2 = data(:,2); % Original Data Vector
L = length(d1);
tv = linspace(min(d1), max(d1), L); % Time Vector For Interpolation
dv = interp1(d1, d2, tv, 'linear'); % Interpolated Data Vector
Ts = mean(diff(tv)); % Sampling Time Interval
t_stats = [Ts std(tv)];
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FTD = fft(dv)/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(1)
semilogy(Fv, abs(FTD(Iv))*2) % Plot Fourier Transform
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
%
Fpass = 50; % Passband Frequency
Fstop = 60; % Stopband Frequency
Dpass = 0.17099735734; % Passband Ripple
Dstop = 1; % Stopband Attenuation
dens = 20; % Density Factor
% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fpass, Fstop]/(Fs/2), [1 0], [Dpass, Dstop]);
% Calculate the coefficients using the FIRPM function.
b = firpm(N, Fo, Ao, W, {dens});
Hd = dfilt.dffir(b);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Digital Filter Design 的更多信息

标签

产品


版本

R2010b

Community Treasure Hunt

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

Start Hunting!

Translated by