From: Virginie Uhlmann on
Hi,
I need to calculate the hilbert transform of a signal, and I don't know how hilbert() works so I read the help and I tried to compute the hilbert of sin(x), which is supposed to be an inverted cos(x).
Here's my test code:

>close all;
>clear all;
>fs=1000;
>T=1/fs;
>n=-10:T:10;
>y=sin(n);
>figure(1);
>plot(n,y);
>res=hilbert(y);
>figure(2);
>plot(n,real(res));
>figure(3);
>plot(n,imag(res));

I find back my sinus from figure(1) in figure(2), so that's ok. However, I don't have a cosine in figure(3), rather a kind of cosine with a "damped" amplitude over time...where does this come from?

Thank you very much for your help.
Regards,

Virginie