I cam across a question in my DSP book asking this:

1). Express $X_2(e^{j\omega})$ in terms of $X_1(e^j\omega)$ without explicitly computing $X_1(e^{j\omega})$. ($X_1(e^j\omega)$ represents the DTFT of $x_1[n]$)

\begin{align} x_1[n] &= \left[1 \ 2 \ 2 \ 1\right]\\ x_2[n] &= \begin{cases} x_1[n] & 0 \leq n \leq 3\\ x_1[n-4] & 4 \leq n \leq 7\\ 0 & \text{otherwise}\end{cases} \end{align}

Here is my code and answer, but Im dont think my answer is correct. What should I be looking for in the time domain graphs that can give clues to the DTFT? ( i know my dtft function needs some work but I will do that next)


%% P3.2
% 1). The magnitude plot of X2(jw) should have a similar shape to X1(jw) because
%     they contain the similar frequency components, but part of X2 is just phase
%     shifted, therefore the angle plots might be a bit different. 
% 2). 

n1 = 0:3;
x1 = [1 2 2 1];
stem(n1,x1); axis([0 7 -4 4]);

n2 = 0:7;
x2 = [1 2 2 1 1 2 2 1]; 
%    ( x1[n])(x1[n-4])
stem(n2,x2); axis([0 7 -4 4]);

k = 0:200;

X1 = dtft(n1,x1,k);

X2 = dtft(n2,x2,k);

function X = dtft(n,x,k)
%  Performs an approximate Discrete Time Fourier Transform 
%  the approximation is due to the fact that the output is 
%  not continous. ex. X = dtft(n,x,k); 
% NOTE : Only for finite duration signals.
%  n = number of samples 
%  x = array containing time domain signal samples
%  k = evenly spaced divisions of omega (frequency)
%  X = the transformed output
%  Various graphs of signal aspects
%  Adapted from "Digital Signal Processing Using MATLAB 3rd ed." - Ingle, V.,
%  Proakis, J. (pg. 65). 
%  ver 1.0 by Dominic Meads  5/8/2020
%  filename: dtft.m
%  The authors reccommend to use this more as an
%  excersize rather than a full function. As stated above, use the DFT for
%  better results.

w = (pi/100)*k;  % calculates the evenly spaced frequencies 
X = x * (exp(-j*pi/100)) .^(n'*k); % calculates the DTFT

magX = abs(X);  % for graphs
angX = angle(X);
realX = real(X);  % divide into real and imaginary parts
imagX = imag(X);

figure('Color', [1 1 1]);
subplot(2,2,1); plot(w/pi,magX); grid off;
xlabel('frequency in units of pi'); title('Magnitude part');
subplot(2,2,2); plot(w/pi,realX); grid off;
xlabel('frequency in units of pi'); title('Real part');
subplot(2,2,3); plot(w/pi,angX); grid off;
xlabel('frequency in units of pi'); title('Angle part');
subplot(2,2,4); plot(w/pi,imagX); grid off;
xlabel('frequency in units of pi'); title('Imaginary part');

1 Answer 1


The problem is asking you to find an analytical expression given $x_1[n]$ and $x_2[n]$. There is no need to compute anything, let alone code it up!

The problem wants you to identify that given the discrete-time domain functions, you use properties of the DTFT to write $X_2(e^{j\omega})$ in terms of $X_1(e^{j\omega})$. You've already identified that $x_2[n]$ contains a shifted version of $x_1[n]$.

You can use the time-shift property which says that if the DTFT of $x[n]$ is $X(e^{j\omega})$ then

$$\mathcal{F}(x[n - m]) = e^{-j\omega m}X(e^{j\omega})$$

Keeping in mind how the domain of $x_2[n]$ is defined, you can use the DTFT properties to express $X_2(e^{j\omega})$ in terms of $X_1(e^{j\omega})$.

  • $\begingroup$ Gotcha. Thanks. Lesson learned: dont jump straight into coding, sometimes the math is all you need. $\endgroup$
    – Dom
    Jul 16, 2020 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.