Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

08-13-2019 03:20 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Labels:

I am using redpitaya for data acquisition, its buffer has 16348 samples but I need more to do a high precision FFT , therefore I would need a buffer in Labview for about 800 thousand samples, therefore I need to append the blocks I am receiving from the redpitaya but there is a distortion between blocks, is any function in Labview that may help me to properly align the end of a block with the beginning of the next?

thanks

08-14-2019 12:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi tecno,

basic LabVIEW knowledge: use BuildArray to concatenate arrays.

(When you know the needed size of your data before reading them from your RedPitaya then you could also InitArray of desired size and use ReplaceArraySubset to fill in those samples at the right place…)

Best regards,

GerdW

CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO

Kudos are welcome

GerdW

CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO

Kudos are welcome

08-14-2019 12:22 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi GerdW:

I think the problem I have will not be solved with BuildArray, lets say we are sampling a 10 Khz sine wave, the end of the block of 16384 samples will not coincide with the beginning of the next block, it will make a distortion, and depending on the frequency a big spike, there is a pic attached, you can see at the beginning the amplitude is 0.45 and at the end is -0.45, if you change frequency the amplitudes are different

Thanks

08-14-2019 12:41 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

What do you know about your blocks of samples? Is it correct to __assume__ that, within a block, the time difference between successive samples is the same? In other words, within a block, there is a __constant__ sampling frequency?

What (if anything) do you know about the __spacing__ between blocks of samples? Those of us who sample using LabVIEW and modern A/D hardware are used to "continuous" sampling, where the time between the last sample of a block and the first sample of the next block is __exactly__ the same as the time between any other successive samples. This makes it easy to combine 100 16,384 arrays of data into a continuous 1,638,400 array of samples, with no gaps.

If you do have gaps of known size (say 100 samples), a not-unreasonable thing to do would be to create an intermediate array of 16,484 samples, with the last 100 being a constant. When you do the FFT, you'll get a spike corresponding to the equally-spaced constant bits, but you can filter this out.

Best, of course, is to get rid of the gaps. Can your hardware do that?

Bob Schor

08-14-2019 02:25 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@tecno404 wrote:

I am using redpitaya for data acquisition, its buffer has 16348 samples but I need more to do a high precision FFT ,

Sigh. I need to learn to read the Original Post more carefully! What do you mean by a "high precision FFT"? Do you want a better estimate of the amplitude and phase of a particular frequency, do you want a wider range of frequencies (particularly at the low frequency end), or do you want to distinguish the spectrum difference between two closely spaced frequencies?

If you keep the sampling rate the same and simply lengthen your sample size (say from 16384, 2^14, to 2^18, this will change the __low frequency__ end of your Spectrum.

If you think that your signal is relatively stationary (i.e. the spectrum does not change much as a function of time), you can improve the estimate of your spectrum by taking repeated blocks of 16384 and __averaging__ them. It helps, of course, if they are "adjacent" blocks, as this will give them a known phase with respect to the other blocks.

If your blocks are __not__ adjacent, but you __know__ the spacing accurately, you can use this information to adjust the phase offsets. If you don't know the spacing, you might be able to "work backwards" and, assuming the spectrum remains stationary (or near-stationary), work out what offset value would produce the overall smallest phase shift.

This is an interesting question/problem, and (I hope) it could serve as a "teachable moment" to understand Signals and their Spectra better.

Bob Schor

08-14-2019 03:27 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Bob:

Yes, the sampling frequency is the same within a block, I am guessing the spacing between blocks is almost the same, I don't have continuous sampling, it is block by block, I will try the intermediate array.

Thanks for your interest

08-14-2019 03:30 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Bob:

thanks for your long email, I want to distinguish between two closed frequencies and I agree with you this is a teachable moment on the FFT and spectrum, very interesting.

Thanks and Best regards

08-14-2019 09:46 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Here's a "hand-waving" way to understand how Spectrum is related to Sampling:

- Assume you sample at frequency fs ("frequency of sampling") for a total length of time T.
- If N is the number of samples you took at frequency fs for time T, then fs = N/T (because "samples-per-second" = samples (N) per (/) second (T). Alternatively, N = fs * T.
- The lowest frequency you can measure is one cycle that occupies the entire sampling interval T, or 1/T.
- The highest frequency you can measure is when the points alternate high, low, high, low. Since you need at least two points (a high and a low) to determine that "something happened), you can resolve N/2 waves in your sample of time T for a frequency of (N/2) / T = fs/2, half the sampling frequency. Does the name "Nyquist" ring any bells?

Bob Schor

- When you compute a spectrum (say, by doing an FFT), you start with N data points, but get "only" N/2 Frequency components going from 1/T to (N/2)/T, 1/T to fs/2. What happened to the other data? Well, each "point" of the spectrum has two values, often called "amplitude" and "phase". [Here comes a bad pun] If this seems a little Complex, just accept it for the time being, and trust that the Math will work out.