multiecho.m

来自「一个matlab里面用的很好用的小工具 是用来算出den,num以及一切zpl」· M 代码 · 共 33 行

M
33
字号
%Multiple Echo
% y = multiecho(x,R,a,N);
%
% Generates multiple echos R samples apart with exponentially decaying amplitude
% Parameters:
%  x is the input audio signal
%  R is the delay in number of samples
%  a specifies the attenuation in the echos
%  N-1 is the total number of echos (If N = 0, an infinite number of echos is produced)
%
% Return value:
%  y is the output signal
%
% Copyright 2004 Vincent Wan
% Credits: Vikas Sahdev, Rajesh Samudrala, Rajani Sadasivam
%
% Example:
%  [x,fs,nbits] = wavread('dsp01.wav');
%  y = multiecho(x,8000,0.5,3);
%  wavplay(y,fs);

function y = multiecho(x,R,a,N);

if (N == 0)
   num=[zeros(1,R),1];
   den=[1,zeros(1,R-1),-a];
else
   num=[1,zeros(1,N*R-1),-a^N];
   den=[1,zeros(1,R-1),-a];
end
y=filter(num,den,x);

⌨️ 快捷键说明

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