LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate a sine wave from array of values?

Solved!
Go to solution

I have an array of points (values) around 1000. I want to plot those values in different types of waveforms - triangle, sine, cosine etc.

How ca I do that? For the triangle waveform i was able to split my array into 2 equal halves and plot the first half and the secind half separatley to generate a triangle waveform. But how do I do it for Sine, Cosine, Sawtooth etc? It is an urgent issue. Prompt reply will be appreciated. Thanks

0 Kudos
Message 1 of 6
(6,657 Views)

Hello,

 

If you are having array of sample data and if you just want to plot sine waveform and cosine waveform, you can use the "SINE & COSINE VI" present under mathematics pallete sub pallete Trigonometry,

 

OR

 

Goto signal processing pallete, signal generation subpallete, here you can find the sine waveform,triangle waveform generation and many more, VI input is a single sample at a time,

so use for loop in both the options.

 

Hope this gets to your required solution.

0 Kudos
Message 2 of 6
(6,653 Views)

True. But I would have to read the values one by one from the array and then repopulate them into an array, right?

I was wondering if there is a mechanism through which  could give my existing array as input at one go and get a sine waveform out of it? 

0 Kudos
Message 3 of 6
(6,641 Views)

The Sine function (and many others) have polymorphic inputs.  Feed in an array of numbers and you get an array of the sines out. Try it!

 

Lynn 

Message 4 of 6
(6,632 Views)
Solution
Accepted by topic author VarunKumar

Hello,

 

The VI in mathematics pallete is a polymorphic, it accepts array input also,.

 

attached a VI for your reference,

 

VI generates 1000 randon numbers and plots the sine and cosine wave,

 

0 Kudos
Message 5 of 6
(6,628 Views)

Oh yes.. my bad.  I am new to LabVIEW and not proficient yet 🙂

Thank you very much, Lynn and cancancanopen. It works.

0 Kudos
Message 6 of 6
(6,620 Views)