Discuss Scratch

eric-pratt
Scratcher
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)
dimitrip
Scratcher
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.
eric-pratt
Scratcher
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.
dimitrip
Scratcher
500+ posts

Sine Wave Mathematics

Would this change satisfy you ?
D.
eric-pratt
Scratcher
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.
dimitrip
Scratcher
500+ posts

Sine Wave Mathematics

Now the sine wave appears to ‘move’ at always same speed, whatever the frequency.
Is it what you meant ?
D.
eric-pratt
Scratcher
15 posts

Sine Wave Mathematics

Yes, thank you! Is it ok if I use this and give you credit?
dimitrip
Scratcher
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.
eric-pratt
Scratcher
15 posts

Sine Wave Mathematics

dimitrip wrote:

Have you been remarking the trick ?
What?
Shuyakado
Scratcher
9 posts

Sine Wave Mathematics

Just do this
resettimer
foreversetx or yto...+sinoftimer*10setxtoxsetytoy

Last edited by Shuyakado (Oct. 14, 2020 23:55:38)

A2d3e2
Scratcher
20 posts

Sine Wave Mathematics

Shuyakado wrote:

Just do this
resettimer
foreversetx or yto...+sinoftimer*10setxtoxsetytoy
umm… what does the … mean
1O1Andrew
Scratcher
100+ posts

Sine Wave Mathematics

A2d3e2 wrote:

Shuyakado wrote:

Just do this
resettimer
foreversetx or yto...+sinoftimer*10setxtoxsetytoy
umm… what does the … mean
Please dont necropost

Powered by DjangoBB