0
$\begingroup$

I have this triangle wave as input:

Input

and I want to derive a sine wave out of it. How do I go about it?

PS: I am doing this in Lua, so any piece of code close to that language would be appreciated.

$\endgroup$
  • $\begingroup$ Could you take a drawing program and show us what kind of output you expect for this particular input? When the waveform abruptly goes back to zero, do you consider this as a rapid frequency increase - and thus, do you expect your sine wave to rapidly move through zero? $\endgroup$ – pichenettes Nov 1 '14 at 11:40
  • $\begingroup$ I'm trying to make that wave smoother by transforming it to a sine wave. I'm expecting same zero-crossing points, same extreme level points but with the smooth of a sine wave. Any mathematical operation to do this? $\endgroup$ – lixir Nov 1 '14 at 13:07
  • $\begingroup$ Yes, multiplying by pi and taking the sin will do the trick. Same extrema, same zero-crossings. $\endgroup$ – pichenettes Nov 1 '14 at 13:09
  • $\begingroup$ y[x] = sin(pi * h[x]) ? where y[x] is the output at sample x and h[x] the input $\endgroup$ – lixir Nov 1 '14 at 13:15
  • $\begingroup$ @pichenettes It's not working properly, as you can see in this input/output picture: hpics.li/9de5a96 $\endgroup$ – lixir Nov 1 '14 at 13:46
0
$\begingroup$

Assuming $x(t)$ swings between -1 and 1, $\sin \frac{\pi}{2} x(t)$ might do the trick.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.