LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate equally spaced points on a sinusoidal wave

Hi all, I need your help!
I want to generate a set of points that follow exactly a Sine curve and the value difference between them must be invariable (fixed and can manually be determined). Just like the triangle wave, the generated points are separated by a step =1. So I would like to do the same thing for Sine wave but it seems impossible, I'm using the waveform generator VI:

Untitled.png

Waveform generator.png

0 Kudos
Message 1 of 6
(4,713 Views)

If the sine wave points should be equidistant in Y, they cannot be equidistant in X and vice versa.

 

The rest is simple math. Create a complex array (x=RE, y=IM) and graph it on an xy graph.

0 Kudos
Message 2 of 6
(4,699 Views)

The waveform datatype is based on equidistant X values (time), and can't be anything else. If you want equidistant Y values, you'll have to make an X/Y plot.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


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

Typically when generating a plot for a sine wave, you might use y = A*sin(mx + c) where A controls amplitude, m frequency, and c phase.

In your case, you want to change y by 1 each step (or similarly, by some non-1 constant value).

So invert your equation to get x = (arcsin(y/A) - c) / m, then plot for the range of y values you're interested in.

 

As James mentioned, you can't do this easily with a waveform graph - use an XY Graph instead (optionally with complex numbers as altenbach wrote).

 

The problem then becomes that a given value of Y has an infinite number of possible X values (compared to the inverse, where a given X produces only one Y value). Also note that some values of Y are impossible to reach, whereas any value of X is valid (Y/A must be between +-1).

 

A partial picture of a possible solution is shown below. I've obscured some parts of the block diagram because I'm guessing you're supposed to do the maths 🙂

SineHints.png

 

Note that if you assume m=1 and c=0, it's a bit simpler.


GCentral
Message 4 of 6
(4,655 Views)

A third interpretation would be to have the points equidistant along the curve (either in the plane or along the curve segments).

0 Kudos
Message 5 of 6
(4,643 Views)

@altenbach wrote:

A third interpretation would be to have the points equidistant along the curve (either in the plane or along the curve segments).


Reminds me to a situaton where we were students sitting in a pub, (after some beer) trying to calculate the extention factor for way home assuming a sine shaped trail with amlitude and frequency somehow related to liters 😄 ... or other boundary conditions 😄

Spoiler
we didn't found a solution at that night, however one of us did a numerical approach later ...   all of us where ee students and we claim that a formal solution is up to math guys 😄
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 6 of 6
(4,612 Views)