# Tag Info

20

Downsampling and upsampling are operations that change the sampling rate of a signal. Each one of them is composed of two steps, changing the sampling rate and filtering. Usually, the amount of change is expressed as a ratio. When downsampling, we are trying to take the signal from some $Fs$ to some $Fs_n < Fs$. The key problem with doing this is that we ...

14

You need to filter first and then downsample. Otherwise, you will run into aliasing problems. I.e. frequencies that are above 30 Hz will create images within your frequencies of interest. You can consider the little script below to compare both methods: Fs = 128.0 t = np.arange(0, 10, 1/Fs) signal = np.sin(2*np.pi*10*t) + np.sin(2*np.pi*50*t) sigma2 = 0.5 ...

14

An image "should not be blurred using a Gaussian Kernel" in general. This can be a safe bet for a lot of basic image processing needs, and a smoothing is almost mandatory when you want to control the information lost by the downsampling. Blurring is (often, not always) another word for low-pass filtering. When an image contains high-frequency ...

9

This derivation is a tricky one. The approach suggested before has a flaw. Let me demonstrate this first; then I will give the correct solution. We wish to relate the $\mathcal{Z}$-transform of the downsampled signal, $Y_D(z) = \mathcal{Z}\{x[Mn]\}$, to the $\mathcal{Z}$-transform of the original signal $X(z) = \mathcal{Z}\{x[n]\}$. The wrong way One could ...

9

I don't get your downsample step when you downsampled by factor $M$. Let me go from scratch with the spectrum visualization below, with time domain, continuous frequency domain and discrete frequency domain from left to right. When we reduce the sampling frequency by a factor $k$, the signal spectrum is copied to new replicas at $f_s/k$. The discrete ...

8

Yes the signal is perfectly reconstructed. Consider the process at each stage as I show using the block diagram below: Consider each sample of the signal at each node in the diagram (each sample is shown using the sample index at the node for each row): (Note: You see the same form of reconstruction in the FFT algorithm). I will attempt to illustrate how ...

8

According to (digital) sampling theorem, signals should be properly bandlimited, before they are (down) sampled. A digital filter limits the bandwidth of the signal and makes it suitable for downsampling without aliasing. A Gausssian kernel is very suitable as a lowpass filter, as it has a number of nice features. The Gaussian function is mathematically ...

7

You don't have a loss in time precision when using FFTs because the FFT is fast. The FFT is just a fast algorithm for implementing the discrete Fourier transform (DFT), nothing more. Instead, there is an inherent tradeoff in time and frequency resolution due to the Heisenberg uncertainty principle. While its statement is explicitly focused at quantum ...

6

You're correct, it has to do with the Cut Off frequency of the Gaussian Blur Filter in its Frequency Domain. In order to see it, just apply a DFT (Using MATLAB it can be achieved by fft / fft2) and look on the absolute value. Look for the -3dB point and you'll see. There is also an intuitive explanation on the original article which say that blurring ...

5

In the final result, you want to express the spectrum $X_d(e^{j\omega})$ in terms of $X(e^{j\omega})$, the spectrum of $x[n]=x_c(nT)$. Since $X(e^{j\omega})$ is already periodic, it must be possible to represent $X_d(e^{j\omega})$ as a sum of a finite number ($M$) of shifted versions of $X(e^{j\omega})$. This is why the original infinite sum is split up into ...

5

The RTL-SDR, as most software-defined radios, has an analog front-end that includes a tunable mixer. This mixer can down-convert the frequency band you're interested in to baseband, where it is sampled. For example, let's say that you want to receive a signal centered around 900 MHz and with bandwidth $2B$ -- that is, the band covers the range from $900-B$ ...

5

First note that when you use a logarithmic function you shall avoid negative arguments if it's output should be real valued. Then consider the following relation: $$y[n] = \ln( 1 + x[n] )$$ where the input $x[n]$ is conditioned such that $0 < 1 + x[n] \leq2$ is maintained. Then a Maclaurin series expansion of this expression will be $$y[n] = \ln(1 + ... 5 Suppose you have initially a real-valued sequence x of length N. The function is basically doing this: To upsample, it transforms to the frequency domain and adds N/2 zeros at the end. Then it transforms back to the time-domain. To downsample, it transforms to the frequency domain and deletes the second and third groups of N/4 elements (which correspond to ... 5 I will explain why method 2 is often a better choice over method 3. The frequency domain approach is equivalent to the "Windowing" method of filter design- in that to do that approach correctly you should window your data before taking the FFT. For an anti-alias filter design in the time domain approach, the least squares filter design algorithm ... 5 Is it possible to combine decimation and low pass filtering in one step? Not necessarily only for images but also for general signals. Yes, that's what people usually do when they implement downsampling: since of the output of the anti-aliasing filter, you throw away N-1 samples, why even calculate these? The trick is to decompose your filter into polyphase ... 5 No. The aliased component will interfere with the non-aliased components and the interference can constructive or destructive. Trivial example:$$x[n] = \sin\left(\frac\pi2n\right)$$If you down sample this to y[n] = x[2n], you get all zeros. 4 Averaging is filtering with a rectangular filter kernel, which has a poor frequency response, both in pass band ripple and stop band attenuation, Because of the poor stop band response it won't anti-alias very well. The non-flat passband will distort the final result even if there is no high-frequency spectral content to alias. 4 Don't be confused; you're doing everything correctly here:$$\begin{align*} f_{sample,in} &&\overset{\text{interpolate}}{\rightarrow}&& f_{sample,intermediate} &&\overset{\text{decimate}}{\rightarrow}&& f_{sample,out}\\ 22 \mathrm{kHz}&&\overset{\uparrow 20}{\rightarrow}&& 440 \mathrm{kHz} &&\overset{\...

4

You will get $Y(z) = \frac1M\sum_{m=0}^{M-1} X(e^\frac{-j2\pi{m}}M*z)$ If you were to upsample first and then downsample you would get $Y(z) = \frac1M\sum_{m=0}^{M-1} X(e^{-j2\pi{m}}*z)$ which just simplifies to (since $e^{-j2\pi{m}}=1$ for $m\in\mathbb{Z}$) $\frac1M\sum_{m=0}^{M-1} X(e^{-j2\pi{m}}*z) = \frac1M\sum_{m=0}^{M-1} X(z) = X(z)$ Basically, ...

4

Your understanding is correct. I don't have the full text of the paper, but it sounds like they aren't being very precise with their description. As you pointed out, downsampling doesn't improve frequency resolution in and of itself, it merely reduces the amount of bandwidth that can be represented unambiguously. However, I can take a guess at what they ...

4

Since I can't comment on this particular site I'd say this, consider the following before you do what you're trying to do. Due to the Nyquist law you want your sampling frequency to be that of the DOUBLE of the maximum frequency your analog signal has. If you downsample to 64 hz that means you'll only be able to see signal data up to 32 Hz. EEG contains the ...

4

First, the P. P. Vaidyanathan condition is a sufficient one, not a necessary one. The upper part keeps every even sample. The lower part convert odds to evens, keeps every (novel) even, and put the (novel) evens back to thir old place. Hence, the delays $z^{-1}$ and $z^{+1}$ exactly interleave the kept evens (top) and odds (bottom). From P. P. ...

4

Is this necessary if I only intend to use the data in the Neural Network toolkit provided by the repo I linked? Yes. Whether or not you are downsampling (instead of just decimating) has nothing to do with classification performance but rather, it is to preserve (as much as possible) the information contained in the signal. When changing the sample rate ...

4

Decimating a signal (selecting every Dth sample and discarding the rest) does not distort the signal within the passband in any way other than to cause aliases from higher frequencies to fold into the signal bandwidth. Depending on how we model the system the phase may be effected since $z^{-n}$ is replaced with $z^{-n/D}$, but the phase will still be ...

4

Since you have already properly low pass filtered the signal, then there is no risk in taking every other sample to complete the downsampling operation. If you were to create a low pass filter that passed your spectrum of interest with no distortion, and rejected all energy in the alias frequency locations then taking every other sample would provide a ...

4

The problem with downsampling is that it can be lossy -- since you're reducing the sampling rate, you can introduce aliasing. So, you can reverse the order whenever downsampling does not result in aliasing. For example, say your discrete-time signal $x[n]$ contains energy in frequencies up to $f_N/3$, where $f_N$ is the Nyquist frequency. Then, downsampling ...

4

Absolutely positively -- uh -- maybe. It depends entirely on the underlying process that generated the original series, what the series "means", how much unique information is actually present in those ten samples, how much you're willing to throw away, and what you know about how that information is structured. At the extreme "no" end ...

4

Interpolation in Frequency (DFT Domain) The implementation is well known. In MATLAB it will be something like: if(numSamplesO > numSamples) % Upsample halfNSamples = numSamples / 2; if(mod(numSamples, 2) ~= 0) % Odd number of samples vXDftInt = interpFactor * [vXDft(1:ceil(halfNSamples)); zeros(numSamplesO - numSamples, 1, 'like', ...

3

Resampling (by rational or even irrational ratios) can be done by low-pass filtering in conjunction with high quality interpolation of all the samples needed for the new rate, directly. No two-step up-sampling following by downsampling is required (although that is one possible implementation for simple ratios). A Sinc kernel, being a reconstruction ...

3

First you need to interpolate between samples rather than just retaining and discarding samples (which introduces horrible jitter noise during non-integer downsampling). Then, if the original audio data contained spectrum around or above 4000 Hz (half the sample rate), you will need to low-pass filter before or in conjunction with the interpolation to the ...

Only top voted, non community-wiki answers of a minimum length are eligible