Sampling a sine wave

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

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).
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.
 

Similar Messages

  • Sampling sine wave and saving the samples in an array.

    helo..
    I am new to Labview and i need some help regarding sampling the sine wave.
    I have generated the sinewave in labview and now i want to sample it.(do i need an ADC for sampling?) and the samples should be saved in an array.
    I dont know how to do this.
    Please tell me how to do this or post some related examples..
    Thanks in advance 

    All of the functions that generate a sine wave in software do save all of the samples in an array. You just need to know how to get them. Since you did not mention the function you used to create the sine wave, lets assume it's the Express VI Simulate Signal. On the signal output, wire a Convert From Dynamic Data type function and select the default 1d Array of Scalars. Right click on the output of this and select Create Indicator. You now have the array. If you are using Sine Waveform which outputs a waveform data type, just wire up a Get Waveform Components function and select the item 'Y'.
    For learning the basics, please see the free tutorials
    Message Edited by Dennis Knutson on 10-28-2008 08:23 PM
    Attachments:
    Get Y Array.PNG ‏4 KB

  • How to get the sine wave sample of the input and output in the same time?

    I discovered that the samples were acquired did not in the same time in my vi.Could you tell me how to get the sine wave sample of the input and output in the same time?
    Output:9263;
    Input:9201
    Attachments:
    singal requency.vi ‏104 KB

    Hello Yun_Zhu,
    Your VI looks like you started from an example, and you are on the right track. 
    To clarify are you trying to synchronize the input and the output waveforms?  If you you will need to share a time base and a start trigger.  Check out the synchronization examples from LabVIEW
    Anthony F.
    Product Marketing Engineer
    National Instruments
    Attachments:
    HIODAQmxSyncMultiDev.png ‏70 KB

  • In order to sample a 3 Hz sine wave, I have to scan it at 30 Hz.

    My setup is as follows:
    I have two PXI 6031E DAQ cards in a PXI 1000B chassis. Each DAQ card connects to a SCXI 1001 chassis. On the first SCXI chassis I have six SCXI 1102C modules and in the second SCXI chassis I have three SCXI 1102 modules. I set up two seperate scan lists. One for the first DAQ card and one for the second DAQ card. The actual scanning functions are placed in seperate threads. After I acquire the data, I move it to "shared memory." The display program reads the value from shared memory and plots the value. For simplicity I left the data as a short int and plotted it that way. If I connect a function generator to any channel I can read a clean wave only if my scan rate is 10
    times the function generator value. For example, if I want to read a 3Hz sine wave I have to set the scan rate on the DataAcq program to 30Hz and the update rate on the display program to 30Hz. Should I be able to read a 3Hz sine wave while scanning at 3Hz? Also, I am open to any recommendations in my code.
    Attachments:
    DataAcq.zip ‏6 KB
    Display.zip ‏5 KB

    What you have discovered is quite normal for acquiring data in the time domain. If you were only interested in the frequency domain, you could follow the Nyquist criteria and sample at a frequency at least twice your desired frequency (6 Hz). Since you wish to examine the data as a sine wave (to view and recognize), you need to sample the waveform at a rate of at least ten times the desired frequency. Hence, to plot and recognize a 3 Hz signal, you would need to sample at a rate of 30 Hz. This action allows ten actual data points per wave cycle.
    As a rule, I use 16 times "oversampling" for my application where I desire to manipulate the data in the time domain. Twenty times oversampling would be even better. It really depends upon the resolution you would like to
    see in your data.

  • Sampling sine wave in labview

    how to read  the corresponding voltage value for each point on sine wave(each sample)?
    please show me the block diagram
    thanks,

    continued here....
    LabVIEW Champion . Do more with less code and in less time .

  • My Sine Wave File sounds different in Logic than iTunes

    I am working on creating musical compositions with embedded sine wave patterns (which I am generating in a foriegn application). These sine waves are designed to entrain the brain to different frequencies to facilitate in stimulating meditative states of consciousness in the listener.
    Unfortunately, when I import my sine wave audio file (in .wav format) Logic changes it and the rhythm is frequency is twice as fast! When I play the file in iTunes it sounds just the way I generated it, but when I import it into Logic through the audio bin or simply drag and drop onto the arrange window, it sounds different and cannot work for the precise control I require for my compositions.
    Does any one have any idea why this is happening or what I can do to import my audio file without changing it?
    Thank you so much for any ideas/assistance,
    Devlin Dewitt Donnelly

    Hi DD Smooth,
    you should check sample rate settings on your original audio files and make them match the sample rate settings on your logic project prior to importing them. Sounds like you are generating 48khz .wav files in your foreign app and Logic must be set to 44.1khz by default. Or the other way around
    Message was edited by: Imol

  • How to count the number of cycles in sine wave

    Hi,
    I am new to Labview.  I have labview 8.2 version and my dataacquisition is NIDAQPAD6015.  I could write a program to generate a sine wave of desired frequency through simulate signal. My question is how do i measure the number of cycles for this sine wave as soon as I run the program. Hope my question  is clear.
    Ravi Mokirala

    To find the offset (which in this case is the Y value midpoint around which the sine wave is symetrical):
    Capture more than one cycle.  Find the min and max values.  Subtract Min from Max and divide by 2.  Then subtract this result from the Max value (or add the result to the Min value).  This is the offset.
    To count the number of cycles where the offset is unknown, just use the first data point value as a reference.  If the next data point is more positive, then count the number of times that the first data point is repeated and the next data point is more positive.  Of course with DBL data type, you probably would not get the exact same value as the first data point, so you need to use In Range with a very tiny limit.  It all depends on your signal amplitude, frequency, and sampling rate.
    Example:  Lets say your first data point value is 0.5 and the 2nd point is 0.55.  You need to look for another value that is between 0.48 and 0.52.  Then read the very next data point value.  If it is greater than the previous value, add one to the cycle count.  If it is less than, you are at half a cycle, do not add to the count.
    - tbob
    Inventor of the WORM Global

  • PXI-board only returns perfect sine wave

    Hi, everyone!
    This is a strange one:
    Im peforming synchronized sampling from two boards; one is a PCI-6224 in my computer and the other a PXI-6229 located in our PXI-system. Being a rookie when it comes to labview, I was quite proud of myself for managing this all by myself. However, when i looked closer at a 10 sec test-record I noticed something peculiar. Although none of the 32 (differential) channels had inputs during the recording, the PXI-board returned 16 perfect 1 Hz sine waves with exactly the same amplitude as the measurement range. Attaching a signal to the terminal block didn't alter this. The PCI-board returns only weak 50 Hz (power network) noise, as expected. What is going on ??
    I'm using a PXI-1031 chassis together with a PXI-8184 controller connected to the PC with a network cable. I trigger the pxi-board by sending the PC-clock through a PFI-port and a physichal wire.
    regards, Einar

    As I said, I haven't used LabVIEW 8 all that much. It's a bit tricky: you'll have to make a new Project, add the PXI as a new Target, and the add the VI you're trying to run underneath the new target. The last time I was playing with this I also had to open some ports in the Windows XP firewall.
    If this is all a bit much for you, you might have a PXI controller that is configured to dual-boot both LabVIEW RT and Windows XP. If you reboot the controller in Windows XP mode, you can then access the PXI-6229 in the same way you currently access the PCI-6224... provided you don't mind copying the VIs over and hooking up a mouse, monitor, and keyboard to the PXI.
    Switching from LV RT to Windows XP is most easily done by selecting the appropriate option in the PXI's BIOS. Check your PXI controller's manual for details.

  • Generating a 6X Sine Wave using an absolute encoder

    How do I get an Analog Signal Generation Synchronized to six times the frequency of an absolute nine bit parallel encoders output with adjustable phase relation. I am using a PXI-6533, a PXI-6711 and have available a PXI-6070E.
    Now the long version of the problem. I have a 9-bit absolute encoder connected to a motor shaft (up to 420Hz). From the encoders 9-bit (0-511) parallel signal I need to create a synchronized 6X sine wave (up to 2500Hzwith an adjustable phase relation. Picture an electronic timing chain. For every cycle of the encoder, I need to produce six full sine wave cycles with a variable tuned phase shift. I have LabView 7 w/RT.
    I have tried to use the Update Clock (PFI5) to step through a buf
    fer but it seems to drop an update every so often. I also have tried to monitor the bit-0 line to determine freq. and scaled the update rate accordingly but the phase shifts all over the place. Does anyone have any ideas on the matter ? I would really appreciate it! Thanx….Phil

    Phil,
    Another different option to solve your application would be to use the new LabVIEW FPGA module and the 7831R reconfigurable I/O hardware. Using these tools you can configure the FPGA on the board to generate the sine wave based on the 9-bit parallel input. The most simple setup would be to have a lookup table in the FPGA that has a corresponding output value to each of the 512 possible input values. This 512 sample table would contain 6 cycles of a sine wave. Every time the parallel input changes the analog output value would be updated accordingly from the lookup table. This setup would also allow to easily add a phas
    e shift of the output by shifting the point in the lookup table you are reading by a known constant.
    Christian L
    NICS
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

  • Generating sine wave

    Hello,
    I have a small labview problem.
    I want to generate a sine wave pulse with labview and send this to a pc oscilloscope by using my soundcard.
    First VI I made creates a sine wave and sends it to the pc oscilloscope. Works perfectly.
    But now i want to create a sine wave with only one period (second VI). Problem is then that the VI blocks if i want a high frequency (I need 10kHz)
    So the VI works on low frequencies but gives this error with higher frequency:
    "the sound driver or card does not support the desired operation."
    Can somebody give a solution for my second VI (creating sine with one period on 10kHz).?
    Thanks in advance!
    Jelle
    Solved!
    Go to Solution.
    Attachments:
    GeneratingSineWaveManyPeriods.vi ‏59 KB
    GeneratingSineWave1period.vi ‏37 KB

    Hello Benje,
    The problem/difference you're seeing is indeed in the coding and also in the sound card.
    In the "working" example you're using the Simulate Signal VI with the following settings:
    - 44100 samples per second (sample rate)
    - Number of samples 10000 (samples per generation cycle)
    In the non working example you specify:
    - sample rate = 1000*"Frequency Control value". This sampling info should be fixed to (for example) 441000 Hz.
    - Number of samples 1000 (samples per generation cycle)
    As a sidenote:
    Is there any reason why you used different functions to generate similar signals in the 2 VI's?
    Kind Regards,
    Thierry C - Applications Engineering Specialist Northern European Region - National Instruments
    CLD, CTA
    If someone helped you, let them know. Mark as solved and/or give a kudo.

  • I am trying to generate a 50kHz sine wave for ten cycles, then aquire this waveform and store it in a file, I am using a PCI-Mio 16E-4 board, has anyone done anything like this?

    I am trying to generate a 50kHz sine wave output on the DAQ card and then simultaneously recieve. I am using a PCI-Mio 16E-4 series board to do this. Has anyone done anything similar. I can generate a 50k wave no problem, and recieve one, but I can not get these vis to run together? Any suggestiosn

    Jrod, yes you should be able to do this, actually there are quite a few example programs come with LabVIEW that handles simultaneous analog input and output, I check the specs of the board you use, the board should be able to handle the sampling/generation rate, but make sure for 50KHz sine wave, you would sample at least twice as fast, preferably ten times the generation rate, then this puts the sampling of the board to thew limit.
    The program you can try is attached here, good luck with the application,
    XD Gao
    Applications Engineering,
    National Instruments
    Attachments:
    Simul_AIAO_Buffer(E-series).vi ‏104 KB

  • How to output a TTL signal from a sine wave [Please Help]?

    Hi evryone!
    I am a bit lost...
    We make the acquisition of voltage (sine wave, 3Hz) which I simulated by a waveform generation in my VI. We want to convert this analog signal to a TTL and output it with a multifunction DAQ (6230).
    I only used Analog to Digital.vi and DAQmx write.vi and I can't get it to work... I get a TTL which is not 3Hz and only If I input a frequency like 3.07 and not 3.00 !!
    Did I forget something ?
    Thanks for helping
    Christophe
    Attachments:
    ADC.vi ‏26 KB

    In your vi, you don't have DAQmx Timing setup.  I don't know what the default value is.  But the timing determines how fast the DAQ will output values.  If not set correctly, you may see slight change in the output frequency.  Another thing is that the timing is based on a master clock, like 50MHz.  The clock gets divided down until it gets near the desired setting.  So it may not be able to achieve 3KHz exactly.  If you are getting 3.07KHz, this may be why.  I don't know if there is anything you can do about it.  Try using the timing vi and setting different sample rates.
    - tbob
    Inventor of the WORM Global

  • Creating and controlling a sine wave

    I am a TA for Control Systems & Instrumentation at Texas State University. As the assistant I am required to assist students in their homeworks and projects. I have encountered a problem in assisting the students. How do I create a Sine Wave wit ha sampling frequency of 200 Hz? Obtain the power spectrum of the signal and change the sine wave frequency to 25 Hz. Determine if the resulting frequency is about the Nyquist frequency. Then increase the sine wave to 125 Hz and compare to the Nyquist frequency again.

    There is an example shipped with LabVIEW 2009 called "Resampling a Waveform (continuous).vi" I think this vi will demonstrate what you are trying to do. Change the sine wave frequency using the frequency control in the Test Signals (A) box and change the sampling frequency by updating the output rate control in the Output timing box. You will then see the original waveform spectrum at the original sampling rate (Fs) and the re-sampled spectrum will be shown in red so you can see the shift.
    Systems Test Engineer
    Certified LabVIEW Architect (CLA)

  • Sine wave frequency error

    Hi! I'm pretty new to labview so any help will be appreciated!
    I'm trying to generate a 6-sine wave pulse using the attached generating and detecting vi. It all looks good, however, the frequency which I want the pulse to be generated ain't quite right no matter how I tweek it. For example, I keyed in the rate of generating pulse to be 1MHz in this case, but the detected signal is only 1 kHz (period = 0.001s). There should be no loss in this case. Other frequencies keyed in are also reduce by a thousand times. I think it is due to my Fs=1000 and #s=1000, because if i change my Fs to be 100 and #s=100, the detected frequency will be reduced by 100 times only. But if I reduce it, the resolution of my signal will be poor and I cant reduce it below 50 for a clear signal. Is there any way I can get the signal generated to be that which I typed in? Help!
    Thanks!
    Attachments:
    detect.jpg ‏48 KB
    generate.jpg ‏29 KB
    graph.jpg ‏118 KB

    Hi, I am using PXI-8331 with analog output PXI-6733 and analog input
    PXI-6133. I am generating voltage signals and collecting voltage
    signals as well.
    The problem I have is that when I
    intend to generate a 100kHz, 4 sine wave in a hanning window pulse, the
    received signal tells me that the signal generated was actually only
    100Hz (reduced by 1000 times) for Fs and #s of 1000, and it will be
    1000Hz (reduced by 100 times)  for Fs and #s of 100. What I hope to
    achieve is for the detected signal to show me that the actuated signal
    is indeed that which is keyed in. I am currently using DAQ assistant to
    control the frequency of my windowed sine wave. Is there any other way
    to go around doing it?
    On a side note, yes, I understand
    Nyquist theorem. I tried using 10kHz generating signal and 1MHz
    sampling frequency (100 times difference) for signal detection, but the
    results is exactly the same as that received using 10kHz sampling
    frequency and thus I believe there should be something I am not getting
    quite right about my signal generation since the frequency is always
    reduced by Fs times and I can't change its period.
     I have attached the vi I am using. Thanks a lot for your reply.
    Attachments:
    combining_testing2_6_2_testtest.vi ‏395 KB

  • Sine wave frequency problem

    hello
    i have some part of my program that is not working well.
    the idea is to sample a 2V sine wave of various frequency and record down the max and min values
    by right i should get around +2 and -2 for my max and min values
    however at frequencies multiple of 5(5k,10k,15k...) i get a reading of 0.0628215 for my max and -0.0628215 for my min.all other frequencies have no such problem.
    i tried changing the sampling time and rate but i still get a close to 0 result for frequencies at multiples of 5.
    may i know what causes the problem and how can i resolve this?

    Hi
    It may sound silly - but do you acquire data fast enough?
    Just have a look at the Nyquist Theorem.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

Maybe you are looking for

  • Select Multiple Rows in a Table without CTRL

    Expecting the user to press "Ctrl" when selecting multple rows is very unfriendly and unintuitive. We'd like the row selection to work as in ALV where you just select multiple rows by clicking on them. We've set the tables rowSelectable to true and s

  • Create Buttons in the Query Designer, is that possible??????????

    Hello, When I Start the Query, I want to choose. For Expample: For Display the Query with the Rows or not.... 1.Button with Film Production 2.Button without Film Production Can I realize 2 Buttons for that ?`?? Thanks and Happy Easter.. Barish Edited

  • Can I alter DataBase Adapter in SOA

    Hi Can I alter DataBase Adapter in SOA or not? Thanks

  • TabIndex & setFocus issues.

    Hi all, I am having a real issue with getting tabIndex and setFocus to work with my custom TextInput component. I have tried everything that I can possibly think of and it just won't work. When I test the component and set tabIndex or setFocus nothin

  • Flex Builder 4 (next version) will be called Flash Builder

    Adobe has just announced that the next version of Flex Builder will be called Flash Builder .. the framework will still be called Flex I think although the change is confusing, in the long run it adds clarity ... here's why ... 1. Flash Builder (form