LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate an ideal sine wave from an inputted sine wave?

Solved!
Go to solution

I have a sine wave that is being inputted, and would like to generate a perfect sine wave that match the inputted sine wave, and then be able to compare them. I'm having an issue getting the frequency correct on the generated signal. The inputted signal is not time based, but rather sample based. It takes a total of 8192 samples, over a full 360 degree revolution, and have anywhere from 2 cycles up to 128 cycles over that time. My initial thought was to do : Average_amplitude*Sine((360/8192)+x)) where x starts at 0. Having that run for 8192 loops gives me a created signal with a frequency that is too high. I've been playing around with this and trying all kinds of combinations I can think of, but can't just can't get the right combo.

0 Kudos
Message 1 of 6
(3,961 Views)

You don't want + x,  you to multiply by x.

 

And don't forget to multiply by 2 pi since the sine function expects the angle in radians.

 

For the acquired sine wave, I'd used Extract Single Tone to get the frequency and the phase angle.

 

You said your frequency is too high, but  your signal is based on samples rather than time.  So if you collect an array of samples, your acquisition rate is going to be assumed to be 1 as in 1 Hz, rather than whatever is the actual time between samples.

0 Kudos
Message 2 of 6
(3,946 Views)
Solution
Accepted by topic author randomguy77

Your "signal processing...signal generation" palette should have "sine pattern" and "sine wave". Both can be used after a proper transform of the inputs. No loop needed.

 

Does you original sine wave have an integer number of cycles?

 

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

The frequency of the wave I am creating is too high. Right now the input has 6 cycles over the total number of samples. The simulated sine wave had 50+ cycles over the same scale.

0 Kudos
Message 4 of 6
(3,916 Views)

Attach your VI instead of adding paragraphs of confusing descriptions. We think graphically!!!

 


@randomguy77 wrote:

It takes a total of 8192 samples, over a full 360 degree revolution, and have anywhere from 2 cycles up to 128 cycles over that time.


So do you have 8192 samples no matter how many cycles, or do you have 8192 samples per revolution, and thus twice as many for two revolution, for example?

0 Kudos
Message 5 of 6
(3,907 Views)

8192 samples total cycles does not affect the total amount collected at all. The sine Pattern VI worked perfectly for me though. Wired it up, and had a sine wave that matched my input one, only ideal of course. Thanks

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