I am trying to generate a set of sine curve values that range from 0 to 1 to 0
I am using seed values of 1 to 100
I have got close with the following formula but it's not correct
If i ranges from 0 to 100
gets me from 0 to
how do I get from
Plain old sin(x) ranges from 1 to -1 on the y axis. You want half of that, so start with y= (1/2)sin(x). Now just add 1/2 to shift it up:
y= (1/2)sin(x) + 1/2
Last edited by ryos (2006-01-20 04:27:11)
El que pega primero pega dos veces.
What frequency did you want?
Just remeber that they use the sin function to model waves.
y = Asin(ωt + Φ)
Your not really modeling a wave but you can use this function to generate any sin wave that you wish.
A is the amplitude, the maximum displacement positive and negative from the x axis.
Φ is just a phase shift, which you can add or subtract based on what height you wish to begin. Otherwise your wave will always start at zero.
ωt is the frequency, if you just make this x and are using degrees you will be at the same point every 360 units. You can divide or multiply x by a constant to vary this as much as you want.
If you divide the frequency by an increasing factor such as another function of x then you will produce a dampening effect which more closely models a true wave.
Learn to play around with all of those factors and you can create a limitless number of different waves.
y = Asin(ωt + Φ)
There is a fourth constant you can use:
y = Asin(ωt + Φ) + C
It doens't mean anything when talking about scientific waves (such as modeling sound), but it can be used to help make the sin graph go through a certain point.
Last edited by Ricky (2006-01-20 10:18:56)
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."