- 积分
- 0
- 注册时间
- 2010-12-8
- 仿真币
-
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2011-8-14 10:09:50
|
显示全部楼层
来自 陕西西安
这个是我用工具箱做的。希望对后来人有帮助。- clear;
- Fs = 1200; % Sampling Frequency
- N = 19; % Order
- Fc = 300; % Cutoff Frequency
- flag = 'scale'; % Sampling Flag
- Beta = 0.5; % Window Parameter
- %% 凯撒窗 %%
- % Create the window vector for the design algorithm.
- win = kaiser(N+1, Beta);
- % Calculate the coefficients using the FIR1 function.
- b = fir1(N, Fc/(Fs/2), 'low', win, flag)
- [h,f] = freqz(b,1,2048,1200);
- figure;
- plot(f,20*log10((abs(h))))
- title('凯撒窗')
- %% 矩形窗 %%
- % Create the window vector for the design algorithm.
- win = rectwin(N+1);
- % Calculate the coefficients using the FIR1 function.
- b = fir1(N, Fc/(Fs/2), 'low', win, flag)
- [h,f] = freqz(b,1,2048,1200);
- figure;
- plot(f,20*log10((abs(h))))
- title('矩形窗')
- %% 海明窗 %%
- % Create the window vector for the design algorithm.
- win = hamming(N+1);
- % Calculate the coefficients using the FIR1 function.
- b = fir1(N, Fc/(Fs/2), 'low', win, flag)
- [h,f] = freqz(b,1,2048,1200);
- figure;
- plot(f,20*log10((abs(h))))
- title('海明窗')
- %% 汉宁窗 %%
- % Create the window vector for the design algorithm.
- win = hann(N+1);
- % Calculate the coefficients using the FIR1 function.
- b = fir1(N, Fc/(Fs/2), 'low', win, flag)
- [h,f] = freqz(b,1,2048,1200);
- figure;
- plot(f,20*log10((abs(h))))
- title('汉宁窗')
- %% 布莱克曼窗 %%
- % Create the window vector for the design algorithm.
- win = blackman(N+1);
- % Calculate the coefficients using the FIR1 function.
- b = fir1(N, Fc/(Fs/2), 'low', win, flag)
- [h,f] = freqz(b,1,2048,1200);
- figure;
- plot(f,20*log10((abs(h))))
- title('布莱克曼窗')
复制代码 |
|