RF2IQ I/Q demodulation of RF data

RF2IQ demodulates the radiofrequency (RF) bandpass signals and returns the Inphase/Quadrature (I/Q) components.



IQ = RF2IQ(RF,Fs,Fc) demodulates the radiofrequency (RF) bandpass signals and returns the Inphase/Quadrature (I/Q) components. IQ is a complex whose real (imaginary) part contains the in-phase (quadrature) component.

  1. Fs is the sampling frequency of the RF signals (in Hz),
  2. Fc represents the center frequency (in Hz).

IQ = RF2IQ(RF,Fs) or IQ = RF2IQ(RF,Fs,[],...) calculates the carrier (center) frequency.

IMPORTANT: Fc must be given if the RF signal is undersampled (as in bandpass sampling).

[IQ,Fc] = RF2IQ(...) also returns the carrier (center) frequency (in Hz).

Note on fractional bandwidth

RF2IQ uses a downmixing process followed by low-pass filtering. The low-pass filter is determined by the normalized cut-off frequency Wn. By default Wn = min(2*Fc/Fs,0.5). The cut-off frequency Wn can be adjusted if the fractional bandwidth (in %) is given:

IQ = RF2IQ(RF,Fs,Fc,B)

The fractional bandwidth (in %) is defined by:

B = Bandwidth_in_% = Bandwidth_in_Hz ${\times}$ (100/Fc).

When B is an input variable, the cut-off frequency is calculated as follows:

Wn = Bandwidth_in_Hz / Fs, i.e:

Wn = B ${\times}$ (Fc/100)/Fs.

Other syntax

An alternative syntax for RF2IQ is the following:


where the structure PARAM must contain the required parameters:

  1. PARAM.fs: sampling frequency (in Hz, REQUIRED)
  2. PARAM.fc: center frequency (in Hz, OPTIONAL, required for undersampled RF signals)
  3. PARAM.bandwidth: fractional bandwidth (in %, OPTIONAL)
  4. PARAM.t0: time offset (in s, OPTIONAL, default = 0)

Additional notes

If the RF signal is undersampled, the carrier frequency Fc must be specified. If a relative bandwidth (B or PARAM.bandwidth) is given, a warning message appears if harmful aliasing is suspected.

RF2IQ treats the data along the first non-singleton dimension as vectors, i.e. RF2IQ demodulates along columns for 2-D and 3-D RF data. Each column corresponds to a single RF signal over (fast-) time. Use IQ2RF to recover the RF signals.

RF2IQ multiplies RF by a phasor of frequency Fc (down-mixing) and applies a fifth-order Butterworth lowpass filter using FILTFILT:

IQ = RF.*exp(-1i*2*pi*Fc*t);

[b,a] = butter(5,2*Fc/Fs);

IQ = filtfilt(b,a,IQ)*2;

Example #1: Envelope of an RF signal

This example shows how to obtain the real envelope of an RF signal by I/Q demodulation

Load an RF signal sampled at 20 MHz.

load RFsignal@20MHz.mat

Demodulate by using RF2IQ.

Fs = 20e6; % sampling frequency (in Hz)
[IQ,Fc] = rf2iq(RF,20e6);
disp(['The center frequency is ' num2str(Fc*1e-3,'%.1f') ' kHz.'])
The center frequency is 4936.4 kHz.

Calculate the real envelope.

RE = abs(IQ);

Display the RF signal and its envelope.

t = (0:numel(RF)-1)/Fs*1e6; % time (in microseconds)
hold on
hold off
axis tight
legend({'RF signal','Real envelope'})

Example #2: Demodulation of an undersampled RF signal

This example illustrates the I/Q demodulation of an undersampled RF signal.

Load an RF signal sampled at 20 MHz (center frequency: 5 MHz).

load RFsignal@20MHz.mat
Fc = 5e6; % center frequency (in Hz)
Fs = 20e6; % sampling frequency (in Hz)

Demodulate the original RF signal.

IQ = rf2iq(RF,Fs,Fc);

Create an undersampled RF signal (sampled at Fs/5 = 4 MHz).

factor = 5; % undersampling factor
usRF = RF(1:factor:end);
usFs = Fs/factor; % (under)sampling frequency

Demodulate the undersampled RF signal.

usIQ = rf2iq(usRF,usFs,Fc);

Display the original RF signal and its envelope.

t = (0:numel(RF)-1)/Fs*1e6; % time (in microseconds)
title('RF signal sampled at 20 Mhz')
legend({'RF signal','Real envelope'})

Display the undersampled RF signal and its envelope.

t = (0:numel(usRF)-1)/usFs*1e6; % time (in microseconds)
hold on
hold off
title('RF signal sampled at 5 Mhz')
legend({'undersampled RF signal','Real envelope'})

See also

iq2doppler, bmode, wfilt


About the author

Damien Garcia, Eng., Ph.D.
INSERM researcher
Creatis, University of Lyon, France

websites: BioméCardio, MUST

Date modified