|
"Penny" wrote in message <ivq9n0$rpn$1@newscl01ah.mathworks.com>...
> t=0:0.05:2*pi;
> a=sin(2*pi*t);
> plot(angle(hilbert(a)))
>
> I don't know why the first phase is not zero.
> Could anyone tell me where the problem is? Many thanks!
- - - - - - - - - -
Beside the points raised by Matt I have a couple of additional observations.
Even if your 'a' signal were not truncated at t = 0 but extended well beyond that time both before and after, I would expect that the value of angle(hilbert(a)) at t = 0 using sin(2*pi*t) would be close to pi/2 rather than zero. The real part, the 'a' value itself, would be zero but the imaginary component added by hilbert(a), which is to be pi/2 (ninety degrees) out of phase with 'a', would then be at maximum value which would give 'angle' a value of pi/2. It is when the real part in 'a' is at its positive maximum and the imaginary part zero that you would get a zero value from 'angle'. If you want an initial phase of zero, you should be using cosine instead of sine.
I notice that you have written:
t=0:0.05:2*pi;
a=sin(2*pi*t);
which would cause the phase to range over 4*pi^2 radians rather than a single 2*pi cycle - your t extends up to 2*pi and the argument of sin(2*pi*t) extends up to (2*pi)*(2*pi). It also means that the increments in the argument of sin(2*pi*t) are not 0.05 but are a larger 0.31415 radians. Is that what you really meant?
Roger Stafford
|