LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I generate of sin wave with multiple frequencies

Dear All,
I am new in LABVIEW and I want to know that can I make a sin or triangle wave of multiple frequencies. I attached the signal diagram that I want and if can I make that waveform then how I can make. Please help me make that type of wave by using LABVIEW coding.
Thanks

0 Kudos
Message 1 of 7
(4,495 Views)

Hi Shesha,

 

there is a palette full of WaveformGeneration functions. Use them to create the several parts of your waveform.

Then there is a palette with generic waveform functions, one of them can be used to append waveforms…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(4,450 Views)

Dear Sir,
Thanks for your reply Now I have to create combine waveform but that waveform is not continuous I mean I want multiple waveforms like that.
I attached the file of waveform and block diagram but this is not multiple or continuous, I want to continues samples of that waveform.
Thanks for giving me a path.

Download All
0 Kudos
Message 3 of 7
(4,422 Views)

Hi Shesha,

 

but that waveform is not continuous

The plot is "continuous" as there are no gaps between the samples apparently…

 

I mean I want multiple waveforms like that.

You can create as many waveforms as you like!

 

When you want to have complete cycles of your sine waves then you need to adjust the amount of samples according to the sine frequency: simple math once ou include the sample rate in your calculation!

(Why do you need ExpressVIs for this task? Use "plain" SignalGeneration functions instead…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(4,414 Views)

Are you looking for a chirp signal?

chirp.png

0 Kudos
Message 5 of 7
(4,402 Views)

Sometimes it helps to go back to First Principles and think about what it is you are trying to do, rather than how to do it with LabVIEW functions or Express VIs or whatever.  Consider the problem of generating a sinusoid of some frequency w (call that "omega", and let it be in "radians per second") -- at time t, the sinusoid is sin (wt) ("sine omega t").  Now let's jump to the "digital" world, where we deal in "samples", meaning that time, t, is really a series of steps of size dt ("delta-t") -- if we know the time at this sample is t, the time at the next sample is t+dt.

 

So how to generate a sinusoid for a constant velocity, w?  Start at t = 0 and compute sin (wt).  At each step, add dt to t (to get a new "t") and output sin (wt) again (with the new t).  Just keep doing this.

 

But now you want to change w (from, say 1 Hz, where w = 2 pi, to 3 Hz, where w = 6 pi).  OK, same formula, but now use the new w.  When w changes again, keep using the same formula with the new w, and keep letting t increase by dt at each step.  

 

Note that if you have a "rule" that says what w is as a function of t (i.e. "w = 1 for 10 seconds, then 3 for 2 seconds, then 0 for 5 seconds, then -2 (meaning rotation in the other direction) for 15 seconds"), you just need to incorporate the "updating w" rule in your computation.

 

It should be relatively simple to write a VI from scratch to do this (and not a bad exercise, especially if you do it right and can look at the output and see Success!).

 

As noted, you can also do this with the generating functions that LabVIEW provides (where they probably do essentially these calculations, but optimized for speed).  You'll notice something called the "phase" in these functions -- this basically corresponds to the value of wt (the current rotation angle at time t) when you make the transition -- you need to match up the "before" and "after" sinusoids so that they meet at the transition time.  If you do jump the frequency, there will be a "kink" in the curve (easiest to imagine if you suddenly stop rotating -- unless you are at the peak or valley, "going flat" will kink the waveform).

 

Bob Schor

 

 

 

0 Kudos
Message 6 of 7
(4,400 Views)

Thank you, Sir, for the reply,
Actually, I got my signal by using append waveform function but I want it continues or also say repeated signal and its stop when the stop button is press.

0 Kudos
Message 7 of 7
(4,390 Views)