Maker Pro
Maker Pro

Nyquist and data logging

cps13

Feb 25, 2013
54
Joined
Feb 25, 2013
Messages
54
Hi,

I'm not sure if this is the correct forum, but couldn't see where else to post.

I'm looking at a datalogging application where I am measuring the force acting upon something due to sea waves. Due to the mechanical setup, my numbers will only be positive. I am trying to research optimum sampling rates, I think the Nyquist theory covers it, that if my wave frequency was 4seconds then my sampling rate should be slightly greater than 0.5Hz.

What I want to do is prove this graphically though, as sea waves are fundamentally sine waves with different frequencies (i think), this should be possible. Everything I can find online about plotting sine waves though just covers a wave with an equal value for positive and negative.

My problem is, I don't know what it is I'm looking for to start researching it, i.e. I don't know the right terms to Goole/look up. I think what I am struggling with is the correct way to plot sine waves.

Can any one help?

Thanks
 

Nanren888

Nov 8, 2015
622
Joined
Nov 8, 2015
Messages
622
Great, thanks a good explanation of where you are.

First, for my understanding, can you explain what you are measuring. I can't initially see why it is always positive. I would have thought that force would be a vector, or at least signed on each axis, first left, then right, then left, ....
Decide whether there is information in the offset, for example if you are sensing only magnitude. If you need it, that is you can't just ignore the DC component, then bear in mind that your dynamic range will need to cope. In any spectrum analysis you'll have a large DC, zero Hz, component.

"optimum sampling rates"? Sample a little faster than "optimum". :)
The force signal, waveform :) will be a continuous spectrum, occupying predominantly a band of frequencies. You need to decide, or find from literature, or otherwise, the band of interest and base calculations on the highest frequency of this band. Filter above this to remove other "noise". sample above twice that.

You didn ot mention quantization. I presume you have that under control. ie enough bits per sample to adequately represent what you want.

For your question: where should you be looking?

For understanding: (Seem some of these you may have already)

Superposition: You can add things to create the waveform. Also that a DC component is additive.

Fourier analysis: Anything periodic can be made from sine, and cos, waves of various frequencies, usually harmonics

Nyquist sampling theory: Says you can sample and reproduce a signal if the sample rate is twice the highest frequency present (In tha baseband case).
That "2" comes sort of from the real signal having a Hermitian (even-symmetric) spectrum so, it's twice as wide as some might first think.

Sampling: Sample and holds, zero-order hold

Aliasing: (This word is used for multiple different things, but likely the main one you'll get is the right one): If you don't sample at an adequately high frequency for a signal component, id 2*f for component at f Hz, you'll not be able to tell the frequency of a component so it will reconstruct to another position.
If you google, a lot of the hits on "aliasing" will be for images. Although this is essentially the same phenomenom the explanations probably won't help, so I;d skip those pages, favouring instead the 1D signal pages.

Anti-alias filtering: If there are higher-frequency components that you are not interested in, or just low-level sea or system noise up to higher frequencies, you should filter these out before the sampling, or they will aliases all the noise up to the bandwidth of your system, back into your pass band.
.
By graphically, do you mean with a figure or two?
https://en.wikipedia.org/wiki/Aliasing#/media/File:AliasingSines.svg is a figure that I like from https://en.wikipedia.org/wiki/Aliasing#:~:text=In signal processing and related,of one another) when sampled.. Not impressed by most of the rest of the page: approach does not really match my field and jargon.

https://web.njit.edu/~joelsd/Fundamentals/coursework/BME310computingcw6.pdf Is not bad on some concepts.
I always found figures in the frequency domain with multiple images of the basic signal spectrum at multiples of the sampling frequency most convincing as they showed aliasing and the need for filtering. The second figure on this page https://www.rs-online.com/designspark/getting-into-digital-signal-processing-sampling-aliasing is the cloests I found just now.

Most of the literature seems to obsess about wave height and direction.
This one has a reasonable summary, if from a statistical perspective. After all, as the waves are a random phenomenum, the spectrum is not fixed.
https://upcommons.upc.edu/bitstream/handle/2099.1/6034/06.pdf?sequence=7

The "dsp guide" by Smith, free online, is not bad, but still not that figure in the frequency domain that I like.

Figure 3.2 of http://www.geethanjaliinstitutions.com/engineering/coursefiles/downloads/ece/dsp.pdf comes closest to the figure that would explain the need for sampling rates and aliasing to me. If the edges of those spectrum images overlap, you can't tell where they reconstruct to, so you will get corruption of the high frequencies.

Notes:
If that "always positive" thing is because you don;t have signed force, that is you sense only magnitude, this may limit what you can do with the answers you get.
Allow a margin, sample faster than suggested: Antialias filters are not brick-wall, that is they don't drop off suddenly at the nominated frequency. You'll need to allow for a slow fall offin power versus frequency. That is, filter out a little above your maximum frequency of interest and sample as if it were even higher,
Like most things, I'd expect forces from seas waves to have a rather wide spectrum, if in open areas, so you;ll have to decide which band the answers you want are in and filter above that.
Not sure how your setup works, but it may be that waves are not the only source of forces. Effectively you are likelly sampling the low-frequency end of all sea noise as well.
For signals with a maximum frequency thatis quite low, modern sampling, data loggers are often not challenged and can be considered as effectively infinitely fast in acquisition of a sample, have intergral sample and hold, so over-sampling, sampling at higher than necessary frequency can make things easier.
Personally, I hate descriptions which include "folding" or "folding frequency". If you have Fourier and complex numbers, then "shifting" will get the correct answers. If your signals are purely real, implying even-symmetric spectra, then "folding" will generally get the correct answer as well, but it's just ugly.
 

cps13

Feb 25, 2013
54
Joined
Feb 25, 2013
Messages
54
Great, thanks a good explanation of where you are.
First, for my understanding, can you explain what you are measuring. I can't initially see why it is always positive. I would have thought that force would be a vector, or at least signed on each axis, first left, then right, then left, ....

First of all, thanks a lot for your reply! A lot of info and incredibly helpful.

My application has a fixed structure in the seabed, this structure then has a supporting arm which protrudes out of the side and can flex in the waves. I have a load measuring device in the moving arm, which measures only in the vertical axis (seabed -> surface). Although other forces may exist on other planes, I'm not measuring them.

Therefore my force will only from 0 - +MAX in the vertical axis. As the arm is supported by the sea waves, and effectively "zero load" and the lowest point of force. In reality, the sensor may record a slight element of negative loading, however I'm not interested in these and would filter them out in post-processing.

In an ideal world, I would see a DC type graph.

thanks
 

Nanren888

Nov 8, 2015
622
Joined
Nov 8, 2015
Messages
622
the correct way to plot sine waves.
For a strictly periodic signal, the spectrum (of sine waves) will be discrete, harmonics of the repetition frequency of the waveform. See Fourier decomposition, Fourier analysis, Fourier series.
.
For a waveform that is not strictly repeating, the spectrum will be continuous, a set of many sinewave frequencies and their harmonics.
.
To explain sampling without "aliasing", along the lines of Nyquist, for such continuous spectra, this leads to the type of figure I suggested above.
Figure 3.2 of http://www.geethanjaliinstitutions.com/engineering/coursefiles/downloads/ece/dsp.pdf comes closest to the figure that would explain the need for sampling rates and aliasing to me.

Did not follow your explanation of being positive, sorry. Any finite amplitude waveform can be made positive by adding sufficient offset. Will assume that this is what you have.
.
Maybe my answers are not doing it for you.
I'd encourage you to add more explanation of your aims or the knowledge gaps you have and maybe someone else will have a try to get you a better answer. :)
 
Top