LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling a sine wave

Solved!
Go to solution

Hi everyone

 

I am looking to sample a signal using labview.

 

I have produced a signal using the "simulate signal" block with controls for amplitude, frequency etc, and have varified that it works.

 

I want to sample this signal at regular intervals and store the data. Can anyone explain how to sample a signal in labview?

 

 

I have looked at the following white paper but it dealt more with the concept of sampling, rather than a tutorial of how to implement it:

 

http://www.ni.com/white-paper/3016/en/

 

 

I also looked at the following, which again didn't actually provide a tutorial:

 

http://www.ni.com/tutorial/3116/en/

 

 

I couldn't find anything else in my search. If anyone can point me in the direction of a tutorial for sampling it would be much appreciated

0 Kudos
Message 1 of 14
(8,373 Views)

Hi David,

 

when you create a sine wave using "Simulate signal" you already have your samples!

So it is unclear, where/why/how you want to "sample your signal" again…

 

Can you please explain, what you really want to achieve?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 14
(8,367 Views)

I understand that, but it is for me to learn how sampling works, so I can utilise it for other applications in future. It is just for learning purposes

0 Kudos
Message 3 of 14
(8,362 Views)

Hi David,

 

sampling means to get the value of a signal at a regular time interval.

 

A waveform in LabVIEW stores values of a signal at regular time intervals (aka dt), so when you create a waveform (even by SimulateSignal) you already get a "sampled signal"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 14
(8,357 Views)

I know what sampling means.

 

Obviously the purpose of the simulated signal is just to provide me with a signal to sample. 

 

Those sampling techniques will then be utilised for sampling real signals on an NI DAQ device. The simulated signal is just to provide me with a learning tool to learn sampling techniques, i.e. acquiring amplitudes at regular intervals

0 Kudos
Message 5 of 14
(8,353 Views)

Hi David,

 

Obviously the purpose of the simulated signal is just to provide me with a signal to sample. 

No, the simulated signal is already sampled. There is no need to sample it again…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 14
(8,341 Views)

I feel that you are being quite pedantic and unhelpful here. Its a learning tool. Its not supposed to be a useful program, but a program to illustrate how to sample, I just need any sample as an input to test the sampling mechanism. I could go out and buy hardware worth a few thousand pounds, buy a signal generator, some cables, a module, connect it all together and then sample it with a DAQ block connected to some sampling code. Or I could just use a signal simulator. The end result of the experiment will not be a solution for nuclear fusion, or a hover car, but the end result will simply be that I understand how to sample a signal. That is the sole objective of this experiment. 

0 Kudos
Message 7 of 14
(8,326 Views)

Hi David,

 

I feel that you are…

I feel we are talking about different things!

 

You want to "learn about sampling", but you start to learn that with a waveform already containing a sampled signal.

When you want to "sample" a sine wave you should start with scalar values. Get those values at regular time intervals and create a waveform from them…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 14
(8,256 Views)

but sampling a simulated sine wave and sampling a continuous signal sine wave is going to work in exactly the same manner

0 Kudos
Message 9 of 14
(8,250 Views)

Those sampling techniques will then be utilised for sampling real signals on an NI DAQ device. The simulated signal is just to provide me with a learning tool to learn sampling techniques, i.e. acquiring amplitudes at regular intervals



I just need any sample as an input to test the sampling mechanism

 

Using an NI DAQ device there are no other 'sampling techniques'. If you look at the vi snippet below, you see that the DAQ vi outputs a sampled signal just like the generate waveform vi. You don't get to do any sampling yourself or use a 'sampling mechanism', just change the input parameters to the vi to tell it sample rate, etc.

Therefore, I'm not quite sure what you are looking for (and obviously neither is GerdW who was actually trying to be helpful).

 

sampling.pngsamplesfp.png

 

If you are looking to observe what happens when you change the sample frequency for a given waveform (in order to experiment with aliasing, etc.) then you can take the given samples and 'downsample' using the Resample Waveform vi.

 

 

Message 10 of 14
(8,205 Views)