Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

**Paul****Member**- Registered: 2006-01-19
- Posts: 4

Hello

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

then

x=sin(i/30)

gets me from 0 to

0.998045198613548 to

-0.190567962875485

how do I get from

0 to

1 to

0

using i

Thanks

Offline

**ryos****Member**- Registered: 2005-08-04
- Posts: 394

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.

Offline

**irspow****Member**- Registered: 2005-11-24
- Posts: 456

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.

Offline

**Ricky****Moderator**- Registered: 2005-12-04
- Posts: 3,791

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..."

Offline

**irspow****Member**- Registered: 2005-11-24
- Posts: 456

Yeah, C would just replace the x axis. In other words whenever y would equal zero it will now equal C.

Offline