Why is the matlab filter order limited by one third of the length of data minus one?

1 回表示 (過去 30 日間)
Baha411
Baha411 2018 年 4 月 28 日
I have a question regarding filters in matlab.
1) I wonder why the filter order in MATLAB is limited by n_order = floor(length(t)/3)-1 as in the example below? Is this a numerical requirement for filter to work?
2) Also, n_order is equal to the size of the window, thus this limit permits creating 3 windows with the maximum order (n_order). Is there a way to create more windows with the same filter order? The code below is just to give an example to you.
t = linspace(0,4*pi,1000);
rng default %initialize random number generator
x = sin(t) + 0.25*rand(size(t));
dt = t(2)-t(1);
Fs = 1/dt; % Sampling frequency
f_band = [0.01 2];
n_order = floor(length(t)/3)-1; % max order (will result in 3 windows)
n_wind_filtLen = n_order+1; % step-length of windows
df = Fs/n_wind_filtLen; % frequency bin size
b = fir1(n_order,f_band/(Fs/2),'bandpass',hamming(n_order+1)); % a=1;
x_fil = filtfilt(b,1,x); % a=1;
figure;
plot(t, x,'-k','linewidth',2); hold on;
plot(t, x_fil,'-.r','linewidth',2);

回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filter Design についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by