blob: 07debdea2d3cbcc0e3d1d63a9b38a789edb0bc35 (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
function inv_ceps = icceps(input, remv_samp)
// ICCEPS computes the inverse cepstrum of a real-valued input. This spectrum
// will be complex in nature
// Inputs:
// input: Real-valued input
// remv_samps: Number of samples of delay to be removed
// Outputs:
// inv_ceps: Inverse cepstrum output
// Check validity of number of inout arguments
checkNArgin(1,3, argn(2));
// Check validity of input signal
checkInputSig(input);
// Seeting default input
if argn(2) < 2 then
remv_samp = 0;
end
input_in_freq = fft(input);
tmp = exp(real(input_in_freq)+ %i*phaseFactor(imag(input_in_freq), remv_samp));
inv_ceps = real(ifft(tmp));
endfunction
function checkNArgin(min_argin, max_argin, num_of_argin)
if num_of_argin < min_argin then
error('Not enough input arguments')
end
if num_of_argin > max_argin then
error('Too many input arguments')
end
endfunction
function checkInputSig(incoming_sig)
if isempty(incoming_sig)| issparse(incoming_sig)| (~isreal(incoming_sig)) then
error('Input is not valid')
end
endfunction
function y = phaseFactor(incoming_sig, delay_elmnts)
len = length(incoming_sig);
input_rnd = floor((len+1)/2);
y = (incoming_sig(:).') + (%pi*delay_elmnts*(0:(len-1))/input_rnd);
if size(incoming_sig, 2)==1 then
y = y';
end
endfunction
|