Documentation Center

  • Trial Software
  • Product Updates

Downsampling — Signal Phases

This example shows how to use downsample to obtain the phases of a signal. Downsampling a signal by M can produce M unique phases. For example, if you have a discrete-time signal, x, with x(0) x(1) x(2) x(3),...., the M phases of x are x(nM+λ) with λ = 0,1,...M−1.

The M signals are referred to as the polyphase components of x.

Create a white noise vector and obtain the 3 polyphase components associated with downsampling by 3.

Reset the random number generator to the default settings to produce a repeatable result. Generate a white noise random vector and obtain the 3 polyphase components associated with downsampling by 3.

rng default;
x = randn(36,1);
x0 = downsample(x,3,0);
x1 = downsample(x,3,1);
x2 = downsample(x,3,2);

The polyphase components have length equal to 1/3 the original signal.

Upsample the polyphase components by 3 using upsample .

y0 = upsample(x0,3,0);
y1 = upsample(x1,3,1);
y2 = upsample(x2,3,2);

Plot the result.

subplot(411)
stem(x,'marker','none');
set(gca,'ylim',[-4 4]); title('Original Signal');
subplot(412)
stem(y0,'marker','none'); ylabel('Phase 0');
set(gca,'ylim',[-4 4]);
subplot(413)
stem(y1,'marker','none'); ylabel('Phase 1');
set(gca,'ylim',[-4 4]);
subplot(414)
stem(y2,'marker','none'); ylabel('Phase 2');
set(gca,'ylim',[-4 4]);

If you sum the upsampled polyphase components you obtain the original signal.

Create a discrete-time sinusoid and obtain the 2 polyphase components associated with downsampling by 2.

Create a discrete-time sine wave with an angular frequency of π/4 radians/sample. Add a DC offset of 2 to the sine wave to help with visualization of the polyphase components. Downsample the sine wave by 2 to obtain the even and odd polyphase components.

n = 0:127;
x = 2+cos(pi/4*n);
x0 = downsample(x,2,0);
x1 = downsample(x,2,1);

Upsample the two polyphase components.

y0 = upsample(x0,2,0);
y1 = upsample(x1,2,1);

Plot the upsampled polyphase components along with the original signal for comparison.

subplot(311)
stem(x,'marker','none');
set(gca,'ylim',[0.5 3.5]); title('Original Signal');
subplot(312)
stem(y0,'marker','none'); ylabel('Phase 0');
set(gca,'ylim',[0.5 3.5]);
subplot(313)
stem(y1,'marker','none'); ylabel('Phase 1');
set(gca,'ylim',[0.5 3.5]);

If you sum the two upsampled polyphase components (Phase 0 and Phase 1), you obtain the original sine wave.

Was this topic helpful?