summaryrefslogtreecommitdiff
path: root/macros/hilbert1.sci
blob: fbcb136475d0de8af852ba53a94e2b1eda62df70 (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
function h= hilbert1(f, varargin)
//Analytic extension of real valued signal.
//Calling Sequence
// h= hilbert1(f)
// h= hilbert1(f,N)
// h= hilbert1(f,N,dim)
//Parameters 
//f: real or complex valued scalar or vector
//N: The result will have length N
//dim : It analyses the input in this dimension
//Description
//h = hilbert1 (f) computes the extension of the real valued signal f to an analytic signal. If f is a matrix, the transformation is applied to each column. For N-D arrays, the transformation is applied to the first non-singleton dimension.
//
//real (h) contains the original signal f. imag (h) contains the Hilbert transform of f.
//
//hilbert1 (f, N) does the same using a length N Hilbert transform. The result will also have length N.
//
//hilbert1 (f, [], dim) or hilbert1 (f, N, dim) does the same along dimension dim.
//Examples
//## notice that the imaginary signal is phase-shifted 90 degrees
// t=linspace(0,10,256);
// z = hilbert1(sin(2*pi*0.5*t));
// grid on; plot(t,real(z),';real;',t,imag(z),';imag;');

funcprot(0);
rhs= argn(2);
if(rhs<1 | rhs>3)
	error("Wrong number of Input Arguments")
end

select(rhs)
	case 1 then
		h= callOctave("hilbert", f);
	case 2 then
		h= callOctave("hilbert", f, varargin(1));
	case 3 then
		h= callOctave("hilbert", f, varargin(1), varargin(2));
end
endfunction