LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I generate a triangle, square and saw tooth wave from an array of points?

I have an array of n points and need to generate a triangle, square and saw tooth waveform from those points. How can I do that?
0 Kudos
Message 1 of 16
(4,853 Views)
I  was able to generate a triangle waveform form my data points by taking the first half of the array as n1, inverting n1 to form n2, and then combining n1 and n2 to form an array m. Then used 'build waveform' to generated a waveform and displayed it using a waveform graph. But I am stuck with the other waveform types.
0 Kudos
Message 2 of 16
(4,851 Views)
I  want to be able to specify parameters of the waveform like number of points, amplitudem frequency from my application
0 Kudos
Message 3 of 16
(4,847 Views)
You could do something like this.
Tim
GHSP
0 Kudos
Message 4 of 16
(4,843 Views)
True. But here I am not trying to generate a continuous waveform. I want to specify through my application the number of data points to be collected. For example: in the interface I can say - Draw a triangle/sine/cosine/square/sawtooth waveform having 1000 points and other attributes like frequency, amplitude. How do i specify the number of points I need?
0 Kudos
Message 5 of 16
(4,834 Views)
Like this
Tim
GHSP
0 Kudos
Message 6 of 16
(4,829 Views)
can u provide the VI in LV 8.5
Vaibhav Gandhi
,
B.E. Instrumentation & Control,
INDIA
0 Kudos
Message 7 of 16
(4,792 Views)

Here you go.

 

 

Tim
GHSP
Message 8 of 16
(4,777 Views)

Well actually my question is a little different. I think I could not state it clearly. Unzip the attached file and run Create Waveform.vi

Provide the following values - number of pints = 1000, negative limit = -1, positive limit = 1 and run.

Now, what I am trying to do here is that I am generating a triangle waveform consisting of 1000 data points with negative limit of -1 and a positiv limit of 1

 

So, I am plotting 1000/2 points from -1 to 1 and another 1000/2 points from 1 to -1

 

I do not need a continuous waveform. The Example.vi that you attached does generate a waveform with a specified frequency, amplitude and sampling rate but specifying the number of data points to be collected is crucial for me. How can I do that?

0 Kudos
Message 9 of 16
(4,753 Views)

The example that was posted does allow you to set the number of samples. If you specify a frequency of 1, sample rate of 1k, 1000 samples, Triangle wave, amplitude of 1, you get a triangle wave with 1000 points and the amplitude goes from 1 to -1. It's not much simpler than that. Your code is generating a half triangle wave and in a much more complex manner (and in the case of the subVIs with those local variables), in a not so elegant manner.

 

p.s. And what would possess you to create a subVI without a border in the icon?

0 Kudos
Message 10 of 16
(4,750 Views)