How do you add a sampling interval to a low pass filter?
5 次查看(过去 30 天)
显示 更早的评论
How do I add a sampling interval of .1s to a low pass filter if I am using the fdesign.lowpass feature? This is what I have so far.
Fc = .99; % cutoff frequency (*pi radians)
N = 63; % filter order
Hn = fdesign.lowpass('N,Fc',N,Fc);
Hd1 = design(Hn,'window','window',@hamming,'systemobject',true);
Hd2 = design(Hn,'window','window',{@chebwin,50},'systemobject',true);
hfvt = fvtool(Hd1,Hd2,'Color','White');
legend(hfvt,'Hamming window design','Dolph-Chebyshev window design')
1 个评论
Mathieu NOE
2021-12-14
hello
you simply have to design a pure delay filter (with is a FIR fiter : F(z^-1) = z^(-nd))
nd depends of your sampling rate and time delay (here 0.1s)
for example is Fs = 1000 Hz (dt = 1/1000 s) you would need nd = 100 samples of delay
回答(1 个)
Shreshth
2024-2-15
Hello Brianna,
I can see from your question that you are trying to implement a low pass filter using the ‘fdesign.lowpass’ function and also incorporating a sampling interval of 0.1 seconds into the filter.
For this purpose you need to specify the sampling frequency Fs as the inverse of the sampling interval. In your case, since the sampling interval is 0.1 seconds, the sampling frequency Fs would be 10 Hz.
You can specify the sampling frequency directly in the ‘fdesign.lowpass’function by adding it as a parameter. Here is how you can modify your code to include the sampling frequency:
Fc = 0.99; % cutoff frequency (*pi radians)
Fs = 10; % sampling frequency (Hz)
N = 63; % filter order
% Define the lowpass filter design object with sampling frequency Fs
Hn = fdesign.lowpass('N,Fc', N, Fc, Fs);
% Design the filter using a Hamming window
Hd1 = design(Hn, 'window', 'window', @hamming, 'systemobject', true);
% Design the filter using a Dolph-Chebyshev window with 50 dB sidelobe attenuation
Hd2 = design(Hn, 'window', 'window', {@chebwin, 50}, 'systemobject', true);
% Visualize the frequency response of both filters
hfvt = fvtool(Hd1, Hd2, 'Color', 'White');
legend(hfvt, 'Hamming window design', 'Dolph-Chebyshev window design');
In the above code, Fs is set to 10 Hz, which corresponds to a sampling interval of 0.1 seconds. The ‘fdesign.lowpass’function now includes the sampling frequency in its parameters, which allows the design process to take into account the correct time domain discretization when creating the filter.
To understand the use of of ‘fdesing.lowpass’ filter you can also refer to the below MathWorks documentation:
Hope it helps.
Regards,
Shubham Shreshth
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!