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

📄 all_pole.m

📁 Real-Time Digital Signal Processing Implementations, Applications, and Experiments with the TMS320C
💻 M
字号:
function all_pole(imp_x, pole_number)
%
% This MATLAB function models the measured room impulse response
% using the all-pole model and compares the result with the
% magnitude response of measured room transfer function.
% This function is invoked by (for example):
%   >>load imp.dat
%   >>all_pole(imp,120)
%

N = 1024;                  % keep the first 1024 samples
xn_data = imp_x(1:N);      % get the first 1024 samples
Xk = fft(xn_data,N);       % fft of room amplitude response 
N1 = N/2-1;                % up to Nyquist frequency
ff = 1000*(0:N1)/N;        % actual frequency up to 500Hz
leng = length(ff);
a = lpc(imp_x,pole_number);% denominator coefficients of RTF
[h,f] = freqz(1,a,leng,1000);% frequency response of model, fs=1000 Hz
maxX = abs(max(Xk));       % maximum X(k)
maxh = abs(max(h));        % maximum h

magXk = 20*log10(abs(Xk(1:leng)/maxX));
                           % normalized by the maximum
plot(ff, magXk,'g');       % plot in green color
grid                       % add grid line 
hold on                    % hold on this plot, and prepare the next

magh = 20*log10(abs(h(1:leng)/maxh));
plot(ff,magh,'r');         % plot the second curve in red color
title('Measured and modeled RTFs');
ylabel('Magnitude, dB'), xlabel('Frequency, Hz');
hold off                   % release hold figure

⌨️ 快捷键说明

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