# How to find complex envelope of a signal in MATLAB?

The transmitted signal $$x(t) = A_c \cos(2\pi f_c t+\phi),$$

I know mathematical expression of complex envelope and its derivation, but how to find its complex envelope in MATLAB?

Assume that $$A_c = 3$$, carrier frequency $$f_c = 1$$ GHz, phase $$\phi = 30$$ degrees.

Could somebody show me the MATLAB code that generates the complex envelope of signal $$x(t)$$?

The hilbert function in MATLAB will return an FFT based approximation of the Analytic Signal, and the magnitude of the analytic signal is the "envelope", but this isn't the "complex envelope" the OP refers to.

The analytic signal is given as:

$$x_a(t) = x(t) + j\mathscr{H}\{x(t)\} \tag{1} \label{1}$$

Where $$\mathscr{H}\{x(t)\}$$ is the actual Hilbert transform of $$x(t)$$.

Note that in general the analytic signal $$x_a(t)$$ is a complex values signal that can be expressed in terms of AM and PM signals, or as in the OP's case, a complex envelope at a fixed carrier. The two forms are listed below, starting with the AM and PM form:

$$x_a(t)= A(t)e^{j\phi(t)} \tag{2} \label{2}$$

Where $$A(t)$$ is a real valued waveform representing amplitude modulation, and $$\phi(t)$$ is a real valued waveform representing phase modulation.

The analytic signal using a complex envelope at a fixed carrier is given here as:

$$x_a(t) = x_c(t)e^{j2\pi f_c t} \tag{3} \label{3}$$

Where $$x_c(t)$$ is a complex waveform as the complex envelope of $$x(t)$$ and $$f_c$$ is the carrier frequency for that envelope.

To extract the complex envelope from the analytic signal, we must define $$f_c$$ and then from that we can solve for the complex envelope directly from \ref{3} as follows:

$$x_c(t) = x_a(t)e^{-j2\pi f_c t}\tag{4} \label{4}$$

The OP's case is simple enough to do by inspection but I will show the details below on how it would be computed, with $$x_a(t)$$ as given below is the analytic signal as would be returned by MATLAB's hilbert function:

$$x(t) = A_c\cos(2\pi f_c t + \phi)$$

$$x_a(t) = A_c\cos(2\pi f_c t + \phi) + jA_c\sin(2\pi f_c t + \phi) = A_c e^{j( 2\pi f_c t + \phi)}$$

using \ref{4}:

$$x_c(t) = x_a(t)e^{-j2\pi f_c t} = A_ce^{j\phi}$$

• are you missing an imaginary unit before the Hilbert transform in the analytic signal expression? (Sorry but its not letting me "at" for some reason...) Jan 12 at 0:33
• Yes! I was, thank you!! Jan 12 at 0:48
• Thank you very much!! I think here envelope is different from complex envelope, I also want to get complex envelope of a signal, Could I get mathematical expression of complex envelope only from known signal Xt in MATLAB? Jan 12 at 3:31
• @kotori I believe this is the complex envelope if you mean by that the amplitude of a complex signal. For example to confirm we are saying the same thing, the complex signal $3e^{j \omega t}$ would also have a constant amplitude of 3. Notice that the analytic signal is a complex signal, and the analytic signal for $3cos(\omega t)$ IS $3e^{j \omega t}$! Jan 12 at 3:34
• I did,thank you! Jan 12 at 4:49