Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

frequency of sine waveform VI

Lynn,

 

I will be constantly sending my signal in as long as the program is running. It doesn't have to show me the frequency right away, but of coure I don't want it to be taking way too long. The produced sine wave will not stop and will run continuously while its state can be changed by my signal half way. And I don't need my signal to be in phase with the produced signal. EMG signal will only be controling the amplitude and frequency.

 

I can change the sampling rate in Simulate Signal VI. But the sampling rate in Peak Detection VI seems very big, and I assume I can't change that at all? So I am struggling what sampling rate I should set the Simulate Signal to be so that I can display them on the same chart.

 

Happy Thanks Giving!

 

Cheryl

0 Kudos
Message 11 of 17
(3,493 Views)

Cheryl,

 

That information is helpful.  I will see what I can do in the way of some suggestions in the next day or two.

 

Happy Thanksgiving to you as well.

 

Lynn

0 Kudos
Message 12 of 17
(3,491 Views)

Cheryl,

 

I put together a VI which generates a crude simulation of the EMG signal. It then uses Extract Single Tone Information.vi to find the frequency and amplitude and generates a sine wave. It also plots errors.

 

Observe the errors as the number of cycles decreases. You can see that Extract Single Tone Information.vi works quite well if you give it several cycles of data and rather poorly when the number of cycles is less than 3. This VI does not have an option for fractional cycles, but the FFT does not do well with 2.3 cycles either.

 

Note that the sampling rate in this simulation is 10000 Hz. The way the multitone generator works it was throwing errors with Fs = 1000 Hz, probably because the harmonics violated the Nyquist criterion at higher fundamental frequencies or larger number of harmonics settings.

 

At your lowest frequency of 1 Hz it would take about three seconds to acquire enough data to get the frequency.  What I would suggest is creating a circular buffer to hold perhaps the last 5-10 seconds of data. Update the buffer 2-5 times per second. Check the frequency after each update. Monitor the detected amplitude, perhaps compared to the rms amplitude of the whole signal. When the amplitude comparison is above some threshold and the detected frequency is in the desired range, create the sine wave.

 

My simulation does not check the effect of frequency changes within a dataset, so I am not sure how it would behave when the frequency changes. I suspect that you would have several seconds where the detected frequency jumps around and the detected amplitude amplitude diminishes and then the new frequency begins to dominate.

 

Lynn

0 Kudos
Message 13 of 17
(3,480 Views)

Lynn,

 

That was impressive. But it might take me some time to understand the program, since I am quite new to Lab View. And I do plan to set a threshold to identify when the generated sine wave should change.

 

Later in my project if I want to send in continuous sine wave from function generator, will Extract Single Tone work in this case?

 

Thanks for your time creating the simulation. This is really helpful.

 

Cheryl

0 Kudos
Message 14 of 17
(3,477 Views)

Cheryl,

 

Please ask if you find parts you do not understand. When programming in LV or when studying a program written by someone else, always keep the Context Help window open. Then click on the Detailed Help link when you want more information about a particular function or VI. The Help is a valuable learning resource.

 

Extract Single Tone Information should work fine with the signal generator.

 

Lynn

0 Kudos
Message 15 of 17
(3,471 Views)

Good morning all !

 

I have a graph (data block) which has for horizontal scale the number of samples while I want to time base the same as I observed in my time base oscilloscope. When I inserted the node properties for to have the correct scale my signal no longer appears. How should I do?

Thank you in advance.
 
I'm a french student in microelectronic at university of Tours.
0 Kudos
Message 16 of 17
(3,441 Views)

Your question has nothing to do with the topic of this thread. Please start a new thread, preferably in the LabVIEW Board. When you do so, include some data because no one on the Forums will have your instruments or know how you set everything up.

 

Lynn

0 Kudos
Message 17 of 17
(3,435 Views)