Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Sine Wave Mathematics
- eric-pratt
-
15 posts
Sine Wave Mathematics
I have a sine wave moving backwards at 10 pixels per frame, using the variable c, which affects the starting point of the wave. The wave has a frequently changing frequency(The problem) and amplitude(Not problematic). The frequency change has an effect on the sine wave's position(Because it may take more or less cycles to reach the correct position). My question is: How do I manipulate c so that the frequency does not affect it's position?
Here's the equation
y=a*(sin((b*x)+c)), A=amplitude(px), b=frequency(Changing non-uniformly), c= -position(Changing + 10 every frame)
Here's the equation
y=a*(sin((b*x)+c)), A=amplitude(px), b=frequency(Changing non-uniformly), c= -position(Changing + 10 every frame)
- dimitrip
-
500+ posts
Sine Wave Mathematics
If you start x always at zero, it should not be a problem: your sine wave at initial point will always be at the same phase shift that you set ©.
Can you share your project ?
Greetz,
Dimitri.
Can you share your project ?
Greetz,
Dimitri.
- eric-pratt
-
15 posts
Sine Wave Mathematics
https://scratch.mit.edu/projects/70222042/ As you can instantly tell, the sine wave moves backwards at different speeds depending on the frequency. And it starts at -240 x.
- eric-pratt
-
15 posts
Sine Wave Mathematics
No, but thanks for the attempt! On both, look at the low-point of an occilation. Change the frequency. The low-point is now moving faster. I want thatto not be the case.
- eric-pratt
-
15 posts
Sine Wave Mathematics
Yes, thank you! Is it ok if I use this and give you credit?
- dimitrip
-
500+ posts
Sine Wave Mathematics
Sure you can use. Have you been remarking the trick ? The c is no more constant but depends on (is multiple of) the frequency.
Greetz,
D.
Greetz,
D.
- Discussion Forums
- » Help with Scripts
-
» Sine Wave Mathematics