主要内容

rceps

实倒频谱和最小相位重构

说明

[y,ym] = rceps(x) 返回输入序列的实倒频谱 y 和最小相位重构版本 ym

示例

示例

全部折叠

一段录制的语音包含由墙壁反射引起的回声。使用实倒频谱将回声滤除。

在音频录制中,一个人用语音说出“MATLAB®”一词。加载数据和采样率 Fs=7418Hz

load mtlb

% To hear, type soundsc(mtlb,Fs)

通过在音频录制中添加延迟 Δ 个采样并由已知因子 α 衰减的信号副本,对回声进行建模:y(n)=x(n)+αx(n-Δ)。指定时滞为 0.23 秒,衰减系数为 0.5。

timelag = 0.23;
delta = round(Fs*timelag);
alpha = 0.5;

orig = [mtlb;zeros(delta,1)];
echo = [zeros(delta,1);mtlb]*alpha;

mtEcho = orig + echo;

绘制原始信号、回声信号以及生成的信号。

t = (0:length(mtEcho)-1)/Fs;

% To hear, type soundsc(mtEcho,Fs)

subplot(2,1,1)
plot(t,[orig echo])
legend("Original","Echo")

subplot(2,1,2)
plot(t,mtEcho)
legend("Total")
xlabel("Time (s)")

Figure contains 2 axes objects. Axes object 1 contains 2 objects of type line. These objects represent Original, Echo. Axes object 2 with xlabel Time (s) contains an object of type line. This object represents Total.

计算信号的实倒频谱。绘制倒频谱并对其最大值进行注解。倒频谱在回声开始到达的时刻有尖锐的峰值。

c = rceps(mtEcho);

[px,locs] = findpeaks(c,Threshold=0.2,MinPeakDistance=0.2);

clf
plot(t,c,t(locs),px,"o")
xlabel("Time (s)")

Figure contains an axes object. The axes object with xlabel Time (s) contains 2 objects of type line. One or more of the lines displays its values using only markers

通过使信号通过 IIR 系统进行滤波来消除回声,该系统的输出 w 遵循 w(n)+αw(n-Δ)=y(n)。绘制滤波后的信号并与原始信号进行比较。

dl = locs(2)-1;

mtNew = filter(1,[1 zeros(1,dl-1) alpha],mtEcho);

% To hear, type soundsc(mtNew,Fs)

subplot(2,1,1)
plot(t,orig)
legend("Original")

subplot(2,1,2)
plot(t,mtNew)
legend("Filtered")
xlabel("Time (s)")

Figure contains 2 axes objects. Axes object 1 contains an object of type line. This object represents Original. Axes object 2 with xlabel Time (s) contains an object of type line. This object represents Filtered.

输入参数

全部折叠

输入信号,指定为实数向量。

输出参量

全部折叠

实倒频谱,以向量形式返回。

最小相位实倒频谱,以向量形式返回。

算法

实倒频谱是序列的傅里叶变换幅值的实数对数的傅里叶逆变换。

注意

rceps 仅适用于实数数据。

rceps[2] 中算法 7.2 的实现,即:

y = real(ifft(log(abs(fft(x)))));

在倒频谱域中进行适当的加窗,形成重构的最小相位信号:

w = [1;2*ones(n/2-1,1);ones(1-rem(n,2),1);zeros(n/2-1,1)];
ym = real(ifft(exp(fft(w.*y))));

参考

[1] Oppenheim, Alan V., and Ronald W. Schafer. Digital Signal Processing, Englewood Cliffs, NJ, Prentice-Hall, 1975.

[2] Programs for Digital Signal Processing, IEEE Press, New York, 1979.

扩展功能

全部展开

C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。

GPU 代码生成
使用 GPU Coder™ 为 NVIDIA® GPU 生成 CUDA® 代码。

版本历史记录

在 R2006a 之前推出

另请参阅

| | | |