Analytic Signal for Cosine

This example shows how to determine the analytic signal. The examples also demonstrates that the imaginary part of the analytic signal corresponding to a cosine is a sine with the same frequency. If the cosine has a nonzero mean (DC shift), the real part of the analytic signal is the original cosine with the same mean, but the imaginary part has zero mean.

Create a cosine with a frequency of 100 Hz. The sampling frequency is 10 kHz. Add a DC offset of 2.5 to the cosine.

t = 0:1e-4:1;
x = 2.5+cos(2*pi*100*t);

Use hilbert to obtain the analytic signal. The real part is equal to the original signal. The imaginary part is the Hilbert transform of the original signal. Plot the real and imaginary parts for comparison.

y = hilbert(x);
plot(t,real(y),'b','linewidth',2);
hold on;
plot(t,imag(y),'r','linewidth',2);
set(gca,'xlim',[0 0.1]); grid on;
xlabel('Seconds');

You see that the imaginary part is a sine with the same frequency as the cosine real part. However, the imaginary part has a mean of zero, while the real part has a mean of 2.5.

The original signal is

x(t)=2.5+cos(2π1000t)

The resulting analytic signal is

z(t)=2.5+e(j2π1000t)

Plot 10 periods of the complex-valued analytic signal.

plot3(t(1:1e3),real(y(1:1e3)),imag(y(1:1e3)));
xlabel('Time','fontsize',14); ylabel('Re{z(t)}','fontsize',14);
zlabel('Im{z(t)}','fontsize',14);

Was this topic helpful?