# generation of sine wave

Status
Not open for further replies.

#### sona_

##### Junior Member level 1
what is the relation b/w no.of samples/cycle and a sine wave.
as I am increasing the no. of samples/cycle it appears the sine wave appears to have less frequency (more loose, to be clear) for the same time period.i figured out everything but could not get the exact reason.all is explained on the basis of nyquist..whereas my mind says that should be concerned to sampling not to the generation of a sine wave.
no of samples should be considered only when we want to sample the sine wave.why is the sine wave being affected when i alter the no. of samples.using simulink i connected a source (sine wave) to a scope.i got the same result.as i increased the no.of samples per period. the scope output showed a sine wave of less frequency.
plz guide i am totally confused

You seem to be tying yourself up in knots here.

1) "more loose, to be clear". Actually, that makes everything you are trying to say less clear.
2) If you increase the number of samples/cycle, and increment the samples at the same rate, you would naturally get a lower frequency. For example, say you have 100 samples/cycle and you clock through those samples at 1 MHz. Your output frequency would be 10KHz (1MHz/100). If you have 1000 samples per cycle, and you clock at 1MHz, your output would be 1KHz (1MHz/1000). Right? This has nothing to do with Nyquist.
3) "concerned to sampling not to generation of a sine wave". Aren't you generating the sine wave digitally? Then you better be concerned with sampling, since you are creating your sinewave from SAMPLES.

• sona_

### sona_

Points: 2
If you increase the number of samples/cycle, and increment the samples at the same rate, you would naturally get a lower frequency. For example, say you have 100 samples/cycle and you clock through those samples at 1 MHz. Your output frequency would be 10KHz (1MHz/100). If you have 1000 samples per cycle, and you clock at 1MHz, your output would be 1KHz (1MHz/1000). Right? This has nothing to do with Nyquist.

thanks for your reply barry..a very basic question, which may sound absurd to you but i am working on my basics..how is output frequency input =1MHz/100 where 1 mhz is clock frequency and input frequency is 100..
tonns of thanks

Last edited by a moderator:

There is no "input frequency". The 100 is the number of samples in a cycle.

• sona_

### sona_

Points: 2
thanku for your help barry...but my query is for the example you quoted ,why output is 1 MHz/no.of samples per cycle

Given that you have a 1 MHz clock used to output sine table and the sine table is one full cycle...

a) 1 MHz with 100 sample sine wave takes 100 clock cycles to output the full sine wave.
b) 1 MHz with 1000 sample sine wave takes 1000 clock cycles to output the full sine wave.
c) 1 MHz with 1,000,000 sample sine wave takes 1000000 clock cycles to output the full sine wave.

a) 1MHz/100 = 10KHz
b) 1MHz/1000 = 1KHz
c) 1MHz/1000000 = 1Hz

Each time you increase the number of samples it takes longer to go through all the table entries and repeat.

Or to look at it from the opposite side (sampling the sine wave).

1) If you sample the sine wave 100x the sine wave frequency then you'll end up with 1 cycle of the sine wave consisting of 100 samples, which were sampled at 100x the frequency of the sine wave.
2) If you sample the sine wave 1000x the sine wave frequency then you'll end up with 1 cycle of the sine wave consisting of 1000 samples, which were sampled at 1000x the frequency of the sine wave.

Now if you want to "play back" the original sine wave at it's original frequency....
1) output the sine wave samples at 100x of the sine wave frequency.
2) output the sine wave samples at 1000x of the sine wave frequency.

• sona_

Points: 2