LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sine wave with alternating amplitudes

Solved!
Go to solution

Hello all,

I'm doing a project on LabVIEW, but I'm still novice in this software.

I want to simulate the breathing sound as one sine wave with two different amplitudes, I searched everywhere but couldn't produce such a signal.

your help is most appreciated.

0 Kudos
Message 1 of 11
(5,478 Views)

What do you mean by "two different amplitudes".

Can you post a picture of what that waveform would look like?

0 Kudos
Message 2 of 11
(5,446 Views)

more specifically, it's a rectified sin wave with 1Hz frequency

the two alternating amplitudes would represent the inhale and exhale events

it would look like the envelope of the following sound signal

0 Kudos
Message 3 of 11
(5,438 Views)

Nothing about that picture looks as simple as a sine wave, or a sine wave with two different amplitudes.

 

But let's assume that you are creating a simplified version of that picture.

 

Create one sine wave of one amplitude for whatever length of time you want it to be.  It looks like 1.6 seconds, so depending on the frequency of that sine wave, pick a time that lets you have complete periods.

 

Do the same for another sine wave with a different amplitude for what again looks like 1.6 seconds.

 

Append the waveforms one right after the other.

0 Kudos
Message 4 of 11
(5,434 Views)

If you're trying to produce the fast oscillating black line (not the labelled line) then I'd suggest starting with a high frequency sine wave with the same total duration you're wanting to produce.

 

Then, produce two half sine waves of different amplitudes and a long wavelength, such that they together have the same duration as your target time. Append the second, lower amplitude half wave to the first using Build Array.

 

Finally, multiply the two arrays (which should have the same length).


GCentral
0 Kudos
Message 5 of 11
(5,410 Views)

Not sure exactly what you're after, but I'll take a wild guess.

  1. Generate a waveform with high frequencies (simulates the lung noises).
  2. Generate a 1/3 Hz sine wave.
  3. Add an offset to the sine wave that's greater than the amplitude, so the result never goes negative
  4. Multiply the lung-noise waveform by the offset-sine waveform.
"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 11
(5,390 Views)

I tried an algorithm that will toggle a Boolean to change the values, it worked fine for me.

but the amplitudes are showing in two separate signals.

to explain more, I attached the vi that I created, the only thing that I still need is to do is to make the white curve appear once, then the red curve, and the would alternate during the loop.

MAG98_1-1583066916495.png

 

0 Kudos
Message 7 of 11
(5,389 Views)

Here's a simplified version:

Test Signal.png

Note that the tunnel on the right edge of the while loop is set to "Concatenating" mode (right click to change this setting), and further that the Flat Sequence Structure does nothing (so I probably should have removed it).


GCentral
0 Kudos
Message 8 of 11
(5,379 Views)

I changed my code to correspond to yours, and this is what i got.

MAG98_0-1583072983239.png

what other changes have you made?

 

0 Kudos
Message 9 of 11
(5,375 Views)
Solution
Accepted by topic author MAG98

Right click on the tunnel with orange wire on right side of the While loop and change the mode. 

 

I used Concatenating, you used Last Value.


GCentral
0 Kudos
Message 10 of 11
(5,372 Views)