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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

signal with varying amplitude

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

0 Kudos
Message 1 of 15
(3,710 Views)

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

0 Kudos
Message 2 of 15
(3,686 Views)

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


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
0 Kudos
Message 3 of 15
(3,678 Views)

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?

 

0 Kudos
Message 4 of 15
(3,667 Views)

@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. Smiley WinkSmiley Happy

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 5 of 15
(3,653 Views)

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

Message 6 of 15
(3,652 Views)

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

Download All
0 Kudos
Message 7 of 15
(3,626 Views)

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. Smiley Wink

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 8 of 15
(3,607 Views)

@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

One sample.PNG

0 Kudos
Message 9 of 15
(3,594 Views)

Hi,

i am trying to generate a continous sample 

 

Download All
0 Kudos
Message 10 of 15
(3,553 Views)