LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling rate and number of samples issue

Hello all, I have simulated two sinusoidal speed signals. The first one switches between 8Hz or 800Hz. A fixed sampling rate of 8000Hz for both has been used and number of samples is 100000/8 and 100000/800 respectively. I run the VI and the output looks okay.

The second signal is a sweep sinusoidal signal similar to the first one only that the frequency ranges from 8Hz to 1000Hz unlike the first which only switches between 8Hz and 800Hz. I have trouble with the sampling info I think because from my VI, i have used the same sampling info from the fist signal which I think is the trouble.

With 8Hz frequency both signals are looking good but when I switch to 800Hz it distorts. My challenge is finding a suitable sampling rate that would maintain a smooth running signal for both signals because when I alter the sampling info, my first lovely looking waveform is distorted.

Download All
Message 1 of 10
(7,771 Views)
I am still having a challenge here please, anybody?
0 Kudos
Message 2 of 10
(7,750 Views)

Hi Maxidivine

I have looked at your code and found that you are aliasing  the signal you are trying to generate. When you select the frequency to 800 you are only generating 125 data points you must increase this to produce the correct signal can I suggest you determine the number of samples you want to have per period and multiply this by the frequency to give you the number of samples.

 

let me know if this helps 

 

Philip

 

 

 


Philip
Applications Engineer
National Instruments
UK Branch

===If this fixes your problem, mark as solution!===
Message 3 of 10
(7,665 Views)

Philip.k wrote:

Hi Maxidivine

I have looked at your code and found that you are aliasing  the signal you are trying to generate. When you select the frequency to 800 you are only generating 125 data points you must increase this to produce the correct signal can I suggest you determine the number of samples you want to have per period and multiply this by the frequency to give you the number of samples.

 

let me know if this helps 

 

Philip

 

 

 


Awesome.  Nice job!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 4 of 10
(7,652 Views)
Thank you so much Philip. Thats really great. I appreciate it.
0 Kudos
Message 5 of 10
(7,625 Views)

Hello all,

I simulate the generation of sin and cos signals with amplitude, frequency and phase entries. But while running the VI , I observed that changing the phase input on the Front panel didn't affect the signal plot, I need to stop the while loop to change takes place on the curve plot. I wonder why.

 

Thanks in advance for your responses 

 

 

 

A.S.B
R&D Dpt
0 Kudos
Message 6 of 10
(6,601 Views)

You really should be opening a new thread as your issue has nothing to due with the problem of 3 years ago.

 

That said, those VIs have a "reset signal" input.  Try wiring a TRUE to those inputs.  Digging into the VI, you can see that the phase is ignored unless the reset signal is set to true.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 10
(6,592 Views)

Thank you, that works with the true value added at the reset input, but the signal stopped waving !

 

By the way I need to write data in the file but I need it to stop writing at a precise time, how doing it ? 

 

Thanks.

 

 

A.S.B
R&D Dpt
0 Kudos
Message 8 of 10
(6,581 Views)

please what is the relation between number of samples and sampling rate?

and how can we choose a suitable value of sampling rate?

0 Kudos
Message 9 of 10
(4,110 Views)

smourad a écrit :

please what is the relation between number of samples and sampling rate?

and how can we choose a suitable value of sampling rate?


Do a Google search for Nyquist theorem.

 

Ben64

0 Kudos
Message 10 of 10
(4,104 Views)