09-10-2018 04:32 AM
Hi,
My issue is similar to this thread. I am trying to get frequency resolution of 0.25 Hz while performing continuous PSD.
I have tried circular buffer, but it doesn't solve my problem.
There are 2 issues,
(i) results not matching with expected output
(ii) -Inf values in PSD, when input signal frequency is in integer multiple.
Pls note, I am using PSD block from Sound & Vibration library.
I have attached simplified version of code (LV12) and snippets herewith.
Please let me know, if any more details are required.
Thanks,
Nikunj
Solved! Go to Solution.
09-10-2018 07:29 AM
Why are you enqueue-ing an array?
Enqueue elements instead. Then in the dequeuer, either wait for an element, or check if it times out.
Not that that will help your problem, but when there's a bug simplification is usually a good idea.
The first two iterations, those PSD VIs are called with uninitialized data. That might screw them up, and the result is put in the shift register. So it might never get better...
09-10-2018 07:40 AM
If you have a piece of code that gives you the "expected" .25 Hz resolution, why aren't you using that?
Do you see the differences in the block diagram between the "actual" and the "expected"?
In order to get 1/4 Hz resolution on a spectrum, you need to collect 4 seconds worth of data before you analyze it.
09-10-2018 07:53 AM - edited 09-10-2018 07:55 AM
wiebe@CARYA wrote:
Why are you enqueue-ing an array?
Enqueue elements instead. Then in the dequeuer, either wait for an element, or check if it times out.
Not that that will help your problem, but when there's a bug simplification is usually a good idea.
The first two iterations, those PSD VIs are called with uninitialized data. That might screw them up, and the result is put in the shift register. So it might never get better...
Thanks for a quick reply.
I do understand your point.
1) In my actual application, I am acquiring signals of multiple channels, hence i kept architecture same, i.e. enqueue-ing array of waveform. Also, I have used same architecture for 'testExpected.vi', which is giving proper output.
2) I initialized all 3 shift registers with waveform of 1000 points and 0 value, still output goes to -ve infinity @ 11hz.
09-10-2018 08:12 AM - edited 09-10-2018 08:14 AM
@RavensFan wrote:
If you have a piece of code that gives you the "expected" .25 Hz resolution, why aren't you using that?
Do you see the differences in the block diagram between the "actual" and the "expected"?
In order to get 1/4 Hz resolution on a spectrum, you need to collect 4 seconds worth of data before you analyze it.
Sorry, I don't understand your point.
As i understand, DeltaF = Fs/ N.
Hence, using shift register I accumulated data of previous 3 seconds and concatenated with current data, to get total 4 second data.
NOTE:
1) Though I mentioned incorrect time domain waveform, but now i understood, it's not a problem. It's going to be like that only.
2) Attached output from trialExpected @ 11hz.
09-10-2018 10:38 AM
Sorry everyone for lengthy post and not asking precise question.
After studying little more, many things are clear. Even I was able to co-relate db level @11hz with signal amplitude.
My only queries remain are
(i) why output goes to -ve infinity in-case of circular buffering?
(ii) why output is not matching for both cases?
I have attached screenshots of both cases, ideal and actual.
VIs for both cases are attached in 1st post.
09-11-2018 04:10 AM
@nik2013 wrote:
I do understand your point.1) In my actual application, I am acquiring signals of multiple channels, hence i kept architecture same, i.e. enqueue-ing array of waveform. Also, I have used same architecture for 'testExpected.vi', which is giving proper output.
OK, that is a valid reason.
@nik2013 2) I initialized all 3 shift registers with waveform of 1000 points and 0 value, still output goes to -ve infinity @ 11hz.
Just remember that initialized shift registers are always preferred, unless you want a memory effect. So even if you don't see an improvement now, I'd keep them initialized. If at some point you start the VI multiple times (sequentially), you will get side effects from previous runs with uninitialized SRs.
09-11-2018 11:35 AM
As i understand, DeltaF = Fs/ N
Delta F = Fs/N
T (acquisition period ) = N*Fs
Delta F = Fs/ (T/Fs) = 1/T
As RavensFan stated. Just a different way of think about it. For example, a 10 s acquisition gives you a 0.1Hz resolution, irrespective of the sampling frequency.
mcduff
09-11-2018 12:24 PM
@mcduff wrote:
As i understand, DeltaF = Fs/ N
Delta F = Fs/N
T (acquisition period ) = N*Fs
Delta F = Fs/ (T/Fs) = 1/T
As RavensFan stated. Just a different way of think about it. For example, a 10 s acquisition gives you a 0.1Hz resolution, irrespective of the sampling frequency.
mcduff
I understand that. But my query is, is my implementation of circular buffer correct? Because, results what I am getting is not matching with expected results.
09-11-2018 12:56 PM
I do not see a circular buffer in your examples, you are just enqueuing data. You need to think about how you want to implement your buffer, it is lossy, do you want to skip adding points to it if it is busy processing, etc.
There are lots of other things in your example that could be fixed, but I do not know whether you just put it together for an example.
Attached is a real hack of the program that will get it to do what you want, but I highly suggest you just look at it to see what can be done and rethink you problem.
mcduff