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);
x = sin(t) + 0.25*rand(size(t));
dt = t(2)-t(1);
Fs = 1/dt;
f_band = [0.01 2];
n_order = floor(length(t)/3)-1;
n_wind_filtLen = n_order+1;
df = Fs/n_wind_filtLen;
b = fir1(n_order,f_band/(Fs/2),'bandpass',hamming(n_order+1));
x_fil = filtfilt(b,1,x);
plot(t, x,'-k','linewidth',2); hold on;