From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-17-2014 03:01 AM
Hi all,
i am very new to LabView. i would like to generate a sin wave with varying amplitudes. lets say i have a list of amplitudes 10, 5 , 2 ,1 .i would like to generate a sine wave with these amplitudes at 200 hz.
Please help
11-17-2014 07:46 AM
Please do it yourself, and when you get stuck or have a problem, post your code and then ask for help. If you are trying to learn LabVIEW, having us "do your homework for you" won't teach you LabVIEW.
BS
11-17-2014 08:19 AM
A FOR loop will help you a lot here...
3 Hour Introduction
6 Hour Introduction
LabVEW Basics
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Learning NI
Getting Started with NI Products
11-17-2014 09:15 AM
Hi Bob,
Thanks for your reply. i just need to know whats the approch i need to follow to solve this issue . should i use an array with these values 10, 5 , 2.5 and loop them to get one value at a time and feed to signal generator?
11-17-2014 09:35 AM
@JGJ87 wrote:
Hi Bob,
Thanks for your reply. i just need to know whats the approch i need to follow to solve this issue . should i use an array with these values 10, 5 , 2.5 and loop them to get one value at a time and feed to signal generator?
Sounds good. There are many ways to accomplish a task in any language and it usually depends on the specific needs of the application as to which is "best". If you just need a waveform to generate a number of points at some frequency and then jump through a series of voltage variations them YES, you are on the right track. Start experimenting, look at some of the examples that ship with LabVIEW (Help > Find Examples... Hardware IO > DAQmx > Analog Out), and don't be afraid to play around and get creative. There's nothing to break with no real hardware attached.
11-17-2014 09:35 AM
The "easy" (but probably wrong) answer is yes, that's exactly what you would do. A For loop will accept an array (of amplitudes) as an input, and output an array of "answers" related to each input.
But it is critical to ask "What are you doing with the value"? [This is the reason so many of us say "Show your code" ...] My suspicion is that you have a "Signal Generator VI" that has an Amplitude input and outputs a time series of values at some rate. If you were writing your own Signal Generator, generating the points one at a time using something like a Timed Loop, you could (internally) feed in your array of Amplitudes and sum each time point as it is being generated, but if the generation is already provided, you need to figure out how to do the combining after the signals are generated. This can, in principle, be done, but it requires multiple (simple) signal generators and the ability to process their output.
BS
11-18-2014 04:03 AM
Hi ,
i have tried a different approach by using mathmatical formula node as a solution but at the moment i cant write the data to the DAQ.i am attaching the the screen shot and vi.
Thanks,
John
11-18-2014 10:02 AM
It's better that you start simple and get a sine wave generated before you try to write your own waveform generation code. There is already a waveform generator that take a formula string as well. Open up Formula Waveform.vi to see how this is done correctly.
Did you look at the examples? Everything you need to know is in them and they DON'T use the dreaded DAQ Assistant or the evil Dynamic DataType (DDT - Blue wires) so you can really learn how to code in LabVIEW without relying on silly, limited "wizard" VIs.
11-18-2014 11:08 AM
@JGJ27 wrote:
Hi ,
i have tried a different approach by using mathmatical formula node as a solution but at the moment i cant write the data to the DAQ.i am attaching the the screen shot and vi.
Thanks,
John
It looks like you are trying to generate the output one sample at a time. That's OK but you need to let DAQ assistant know that's what you are doing
11-20-2014 09:10 AM
Hi,
i am trying to generate a continous sample