2
$\begingroup$

Given an array x of size 2000, is there any way to calculate (or estimate) the sampling frequency using Matlab? The values are the only information I have about the signal. I know the signal has been sampled with Fs = 360 Hz but I want to know if there is any way to extract this information from these plots.

This is the signal plot, it is an ECG:

enter image description here

And this is the FFT:

enter image description here

$\endgroup$
2
$\begingroup$

Given an array x of size 2000, is there any way to calculate (or estimate) the sampling frequency [...]? The values are the only information I have about the signal.

No.

I know the signal has been sampled with Fs = 360 Hz but I want to know if there is any way to extract this information from these plots.

No.

The sampling frequency is an intrinsic characteristic of a discrete sampled signal. Any operation on the sampled signal uses Fs either implicitly or explicitly. The only way to infer the sampling frequency is to inject or detect a pilot tone on a properly sampled signal.

For example, the Discrete Fourier Transform does not make explicit reference of the sampling frequency. The DFT simply decomposes the signal into the sum of those sinusoids that can be supported by the "data frame" of length $N$ that it is presented with. But, when you then want to go from "wave number" or "bin", back to the physical frequency it represents, then you have to know the Fs.

If you don't use the "right" Fs, then you might run into the condition of aliasing where you basically cannot trust the numbers you are looking at because they are an uncontrolled overlap of the signal spectrum and itself. This is why, the anti-aliasing filter is a key component in the analog pathway of the signal BEFORE the analog to digital conversion. The anti-aliasing filter will make sure that no frequency very near or above $\frac{Fs}{2}$ will make it through the system.

If we were to remove this filter, the digital processing part's outputs would become unreliable.

Having said this and as is pointed out by @Fat32, if you are absolutely sure that the sampled signal adheres to this restriction and it was sampled without aliasing then you can infer the Fs. BUT, this cannot be done with a random Electrocardiogram. Or rather, it really depends on the sort of accuracy you are after.

A standard electrocardiogram waveform's harmonics can extend to 100Hz.

The question now is, what is the actual bandwidth of THIS specific ECG that you have in your hands? That one, may indeed have been obtained with a standard montage but it contains noise and baseline wandering. Also, depending on what the patient was doing, the signal would be different and its bandwidth would be different too.

Therefore, which DFT bin corresponds to that 100Hz is uncertain.

If you are interested in a ball park figure, you can look at a point in the signal's DFT where its power drops below an average background noise and take that point as your 100Hz nominal value and work backwards to what Fs was used. But that would certainly not be accurate, especially when "strange" Fs are used (like 128.5 Hz).

So, in the general case, it is impossible to "second guess" the sampling frequency from a discrete signal's values.

The only exception to this is to ensure that no aliasing will occur (i.e. sample high enough) and use a pilot tone. That is, a tone or other signal whose spectrum you know exactly or can control fully.

If there was a single pilot tone in the signal then you could say, I know that the pilot tone is at 1kHz, it shows up on the DFT output as a high output on bin k, then I can work backwards to estimate the correspondence of bins to physical frequencies.

Could there be such a pilot tone in your signals?

Yes, it is likely that your signals contain power line interference. This will show up as a consistent set of spikes in the DFT because it is not only that you would be looking at a sinusoid of 50Hz but you would get a few harmonics along too.

The frequency of the power line is not exactly 50Hz (in Europe at least) but it has to adhere to strict standards, so perhaps for the relatively short duration of the ECG it could be used as a pilot tone at an assumed value of 50Hz.

Of course, it is not necessary that the ECG contains power-line noise. It may have been suppressed by a filter or other shielding at the point of acquisition. In that case, you are back into "it cannot be done" response.

Hope this helps.

$\endgroup$
1
$\begingroup$

If you exactly know the analog signal's bandwidth, and if you make sure that there is no aliasing during sampling, then you can tell the sampling frequency by analysing the DFT(FFT) spectrum of the obtained samples.

The following relation shows that $$ \frac{f_c}{fs} = \frac{k_c}{N} $$ where $f_c$ is the analog signals coutoff frequency, $f_s$ is the sampling frequency, $k_c$ is the integer index of the signal DFT(FFT) at which the spectrum cutoff happens and $N$ is the number of DFT(FFT) points with $k_c < N/2$.

If you are unsure about the signal's cutoff frequency, then you will have a treble.

$\endgroup$

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.