4
$\begingroup$

I have a problem to solve, I need to get the frequency spectrum from the first plot, and then transform it into the second plot using resampling and filtering.

Objective

My thought process was, I can upsample by a factor of 2, then hi-pass > 1000Hz to filter only the mirror image, then downsample by a factor of 2.

I have a hard time verifying my solution and seeing the intermediate steps, and even trying to simulate that on MATLAB.

Is it correct?

my prediction

$\endgroup$
6
  • 1
    $\begingroup$ Another way to do this would be to rotate the spectrum around the unit circle by half a turn. To do so, simply mix the signal $x[n]$ by $e^{j\pi n}$ $\endgroup$
    – Jdip
    Jan 15 at 18:11
  • $\begingroup$ What is your sampling frequency? $\endgroup$
    – learner
    Jan 15 at 18:17
  • $\begingroup$ Hi @Jdip, thanks for your feedback, the problem asked specifically to use resampling methods. $\endgroup$ Jan 15 at 19:02
  • $\begingroup$ Hi @leaner, the sampling frequency was not given, we can however upsample and downsample by any factors we wish $\endgroup$ Jan 15 at 19:03
  • $\begingroup$ I think it's safe to assume it's $2000\,\texttt{Hz}$ $\endgroup$
    – Jdip
    Jan 15 at 19:43

2 Answers 2

6
$\begingroup$

Mirroring the spectrum would be trivial by multiplying with alternating +/-1. The OP mentioned in the comments under the question that it is to be done with resampling and filtering alone; a solution in that case is to upsample by 3, high-pass filter and then downsample by 2.

It is helpful to plot the periodic extended spectrum with the frequency axis extending to $\pm \infty$, and knowing that everything in the range of $\pm f_s/2$ (the first Nyquist zone) will repeat in frequency exactly in every higher zone centered on each integer multiple of the sampling rate $f_s$. Thus we see how with upsampling when we move the sampling rate to a higher value, all those original images remain, which includes the rotated image in the range from $-f_s/2$ to $f_s$ where $f_s$ in the original sampling rate.

If we understand how aliasing works in A/D conversion, and specifically how we can undersample with bandpass filtering; downsampling works the same way: For all those images in the extended frequency spectrum we can bandpass (highpass in this case) to select a particular image and then “undersample” via downsampling.

Here are some illustrations to make these concepts clearer. The first is we assume that what the OP has shown is the magnitude spectrum for a real signal, plotted from DC to half the sampling rate or $f_s/2$. Since it is real, the negative frequency spectrum will be the complex conjugate, so if we plot the complete unique frequency spectrum from $-f_s/2$ to $+f_s/2$ it would appear as follows:

complex conjugate real spectrum

The next point is this spectrum periodically repeats as we alternatively extend the spectrum toward $\pm \infty$. This is mathematically accurate and equivalent, but since everything repeats exactly, we typically do not show the spectrum like this and just show what it is from $-f_s/2$ to $+f_s/2$ (or even DC to $+f_s/2$ for real signals), since all the information is provided in that. However I find the visualization of the extended frequency spectrum helpful towards intuition for multi-rate processing.

With that said, take all the spectrum centered about DC in the range of $-f_s/2$ to $+f_s/2$ and copy it at every multiple of the sampling rate as done in the graphic below:

extended spectrum

Now for visualizing upsampling (as done by inserting zeros in between each sample), we simply move the sampling rate accordingly while not changing the spectrum. For example, and upsample by 2 would divide the sampling rates given above by 2 and result in the following spectrum where $\hat{f}_s=2f_s$ (pay attention to what the spectrum now looks like in that primary $-\hat{f}_s/2$ to $+\hat{f}_s/2$ range:

upsampling

With downsampling it helps to understand the sampling process in general starting with sampling an analog spectrum. Below is a graphic showing in the top row an analog spectrum at baseband, and in the second row is the spectrum of the sampling process, which consists of an impulse at integer multiples of the sampling rate. In the frequency domain the two convolve, resulting in the bottom plot which is the periodic spectrum extended to $\pm \infty$. The takeaway here is we can just consider what would map directly from the top row to the bottom row, and then knowing that whatever is in any Nyquist zone in the digital spectrum must repeat in all the others. For clarity I colored the "direct mapping" orange to then show the case for undersampling.

direct sampling

Here below is the similar process shown for the case of undersampling, where here I also labeled what is referred to as "Nyquist Zones". Above was the case of sampling from the first Nyquist Zone (direct sampling) and below is the case for sampling from the third Nyquist Zone. We note that the SAME digital spectrum results! Copy the spectrum directly from the top row to the bottom row (as colored in orange), and then fill in the rest of the digital spectrum knowing that it must repeat as given in all the other Nyquist zones. This is what would happen when we undersample from any odd Nyquist zone.

undersampling

Now consider when we sample from Even Nyquist zones: the spectrum reverses as shown below!

spectrum reversal  even Nyquist zone undersampling

Undersampling is just downsampling from an infinitely sampled signal (continuous time), the same concepts apply to downsampling from one sampling rate to another. With this we see a solution is to upsample by 3, high-pass filter, and then downsample by 2:

resulting resampling

$\endgroup$
7
  • $\begingroup$ Hi @dan-boschen , thanks for your answer! I have a question, I have edited my original post to show my thought process. My signal seems to be shifted +1000Hz from what I want to obtain, is that fixed with the downsampler? $\endgroup$ Jan 15 at 20:34
  • $\begingroup$ @RicardoSilvestre yes, let me add a graphic to make it very clear. $\endgroup$ Jan 15 at 20:36
  • $\begingroup$ @Hi Dan! It's been a while! Have a look at this problem please. It seems they don't bother ? :-) Can you provide an analytic solution? Can I trust you? I do actually: think It like a puzzle... :-) $\endgroup$
    – Fat32
    Jan 15 at 21:59
  • $\begingroup$ @Fat32 Wow! Hey long time no see, I will take a look once I scrounge some more time. I hope you are doing well $\endgroup$ Jan 15 at 23:05
  • $\begingroup$ @RicardoSilvestre see my update, I think it is up by 3 and down by 2 $\endgroup$ Jan 15 at 23:05
0
$\begingroup$

If the sampling rate is indeed $2kHz$ you simply need to flip the sepectrum. That can be done easily by

$$y[n] = x[n]\cdot (-1)^n$$

Quick explanation. This is in essence a modulation with the Nyquist Frequency, i.e. $(-1)^n = e^{-j\pi n}$. This shifts the entire spectrum by $f_s2$ so the negative frequencies shift into the positive frequencies, etc.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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