%% Compute The Analytic Signal
% Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).
% Compute the analytic signal of a sinusoidal input.

t = (-1:0.01:1)';
x = sin(4*pi*t);
anaSig = dsp.AnalyticSignal(200);
y = anaSig(x);

%
% View the analytic signal.

subplot(2,1,1);
plot(t, x)
title('Original Signal');
subplot(2,1,2), plot(t, [real(y) imag(y)]);
title('Analytic signal of the input')
legend('Real signal','Imaginary signal',...
    'Location','best');

% Copyright 2012 The MathWorks, Inc.