09-25-2022 03:44 PM
Hello! I need to create a VI that generates a continuous composite sinusoidal waveform,Vo. It will have two frequencies f1 and f2 with voltage amplitudes A1 and A2. This should have input terminals to input the numerical values of A1, A2, f1 and f2, and an output chart that displays the waveform Vo. I've created the input numerical value and the waveform but I am not sure how to make it as a continuous composite sinusoidal waveform as the picture below. Would I have to use the sine waveform and how would I connect it?
Use A1 = 1, A2 = 2, f1 = 1 Hz, and f2 = 2 Hz.
Help please and thank you!
09-25-2022 05:47 PM
You can do this with functions from the Waveform palette.
You will find all functions required to accomplish the above hints from the waveform palette
09-27-2022 10:12 AM
LabVIEW is (literally) an "Engineering Workbench" (that's the "EW" in "LabVIEW"). If (as an engineer) you want to generate a Waveform, you'd do it digitally, which means that you'll be specifying a waveform by specifying its value at equally-spaced intervals of time (called "dt" in LabVIEW's Waveform terminology).
If you are already familiar with (and have used) the Waveform type in LabVIEW, then @santo_13's method should work for you. Of course, you'll need to make sure that both Waveform A1 and A2 have the same value of "dt" (which might or might not fit your Problem statement). Note that you'd use the Append Waveform function in the "Analog Wfm" sub-Palette to make a single A1+A2 "wave", then you can simply "play" that Waveform over and over as much as you want.
Otherwise, you should be able to find some tutorial material on LabVIEW's Waveform type. Once you get the idea that a Waveform is simply a LabVIEW-defined cluster with three (four, actually) major components, T0, a TimeStamp when the Waveform starts (which is probably unimportant to you), "dt", the Sampling Interval, and Y, the points in a single cycle, you can even build the Waveform yourself. Decide on what Period you want for A1 + A2 (let's call this "Period"). Decide on the number of Samples you want in this period (let's call this "N"). Define "dt" as Period / N. Now generate one A1+A2 Waveform as follows:
[It is possible I missed a step somewhere, but if you code this up and then plot the Waveform on a Chart, it should be trivial to see (and fix) the bug. That's one of the really nice things about LabVIEW, how easy it is to write little pieces of code and check that they really work.]
Bob Schor
P.S. -- just did what I suggested -- got what I expected.
09-27-2022 10:43 AM
@Bob's method will give you better performance than mine as you don't continuously build arrays.
Comparatively, both methods take around the same time to code (if you are familiar with the functions).