⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 firfiltercoef.m

📁 CHP 4 - Real-Time Digital Signal Processing: Implementations and Applications, Second Edition by Sen
💻 M
字号:
% 
%  Project: Example 4.18: floating-point implementation of FIR filter - Chapter 4
%  File name: firFilterCoef.m   
%
%  Description: This MATLAB script generates the FIR coefficients
%               and use the filter on a given input data
%
%  For the book "Real Time Digital Signal Processing: 
%                Implementation and Application, 2nd Ed"
%                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
%                Publisher: John Wiley and Sons, Ltd
%
%
% Write for MATLAB v 7.01
%

fid = fopen('..\\data\\input.pcm', 'r');
in = fread(fid, 'int16');
f=[0 0.3 0.4 0.5 0.6 1];
m=[0 0 1 1 0 0 ];
b=remez(47, f, m);
[h, omega]=freqz(b,1,512);
plot(f,m,omega/pi, abs(h));

y=filter(b, 1, in/32767.0);
p=spectrum(y, 128);
p2=spectrum(in, 128);

figure(1);
plot(20*log10(abs(p)));
grid;
figure(2);
plot(20*log10(abs(p2)));
grid;
fclose(fid);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -