-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelay.m
More file actions
34 lines (30 loc) · 830 Bytes
/
delay.m
File metadata and controls
34 lines (30 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function y = delay(x, fs, seconds, nTaps, decay, gain)
%% This is where the help file goes...
%
% Syntax
% ...
%
% Description
% 'head' is used to set the number of zeroes before the delayed signal.
% 'tail' is used to set the number of zeroes after the delayed signal.
% 'gain' is used to set the amplitude of the signal.
% 'decay' is used to decrease the amplitude of the signal, multiplicatively.
% 'newDelayLine' is used to store the delayed signal at each iteration of the for loop.
%
%
% Examples
%
%
% References
%
% ...
%
nSamples = round(seconds*fs);
y = [x; zeros(nTaps*nSamples, 1)]*gain;
for tapNo = 1:nTaps
head = zeros(nSamples*tapNo,1)
tail = zeros((nSamples*nTaps)-(nSamples*tapNo),1)
newDelayLine = [head; x; tail];
gain = gain*decay;
y = y + newDelayLine*gain;
end