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

📄 swsmodel2.m

📁 非常好的数字处理教程
💻 M
字号:
function [F,M] = swsmodel2(D,R,P,H,O)% [F,M] = swsmodel(D,R,H)  Sine wave speech analysis%       D is a speech example sampled at R samples per second.%       Return a sinusoid model of up to P/2 components with each sinusoid%       defined by a row of F (frequencies in Hz) and M (linear magnitude). %       Each column of F and M corresponds to H samples at R.%       Rows of F are sorted with lowest frequency first; %       sinusoids cannot cross.%%       Relies on lpcfit.m and lpca2frq.m to form LPC model (H and O define%       window size and overlap, respectively) and convert it into frequencies.% 2001-03-12 dpwe@ee.columbia.eduif nargin < 2  R = 8000; endif nargin < 3  H = 0.02*R;end% Target sampling rateMyR = P*1000;% Resample to P kHz, so LPC only picks main formantsif R ~= MyR  D = resample(D, round(MyR/1000) ,round(R/1000));end% Step size in units of my sampling rateHH = 2*round(H/R * MyR/2);% Form Pth-order LPC model (3 or 4 pole pairs)lpca = lpcfit(D,P,2*HH,HH);% Convert poles to sorted freqs and magnitudes% If only 3 nonzero freqs are found, 4th row will have mag/frq zero[fa, ma] = lpca2frq(lpca);% Convert frqs into HzF = fa'*MyR/(2*pi);M = ma';% Check for overflow values of amplitude and adjust to min/max rangei=find(M>1.0);if ~isempty(i)	M(i)=1.0;endi=find(M<0.0);if ~isempty(i)	M(i)=0.0;end

⌨️ 快捷键说明

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