Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -

Login

Username

Password

Not registered yet?

#1 2006-01-20 23:47:50

Paul
Novice

Offline

Sines

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

#2 2006-01-21 03:26:22

ryos
Power Member

Offline

Re: Sines

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-21 03:27:11)


El que pega primero pega dos veces.

#3 2006-01-21 08:42:26

irspow
Power Member

Offline

Re: Sines

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.

#4 2006-01-21 09:18:00

Ricky
Moderator

Offline

Re: Sines

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-21 09: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..."

#5 2006-01-21 09:24:32

irspow
Power Member

Offline

Re: Sines

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

Board footer

Powered by FluxBB