// Writing in AVR Studio 5 (gcc), using Xplain -Xmega128A1.
Hello. I have 3 questions:
1) I'll make an amplitude that has a value between 1 and zero, by using this formula:
Amplitude = sin ((X - 3000) / (4000/180))
X is a random variable drawn from a normal distribution table.
How can a write the code? can I use the sine in C?
2) I have made "‹"‹a normal distribution table that goes from 0 to 4000
How can I use a timer to pick out the X?
X shall be a random number from the table, using a timer.
and finally ....
3) convert this sentence from _delay_ms to _delay_us.
rand1 = 4 + (uint16_t) ((double) rand () / ((double) RAND_MAX + 1) * 3);