- Joined
- Jul 4, 2009
- Messages
- 16,556
- Helped
- 5,157
- Reputation
- 10,347
- Reaction score
- 5,218
- Trophy points
- 1,393
- Location
- Aberdyfi, West Wales, UK
- Activity points
- 140,017
I appreciate there may be language difficulties but how many times do we have to explain. :-x
Phase1 = starts at the beginning of your table
Phase2 = starts one third of the way along your table
Phase3 = starts two thirds of the way along your table.
Try this:
Plot a graph of the 240 values in your table, it should give a close approximation to a sine wave.
Plot another graph line of the 240 values, this time starting one third along (index 80), wrapping back to the beginning when you reach the end until you reach index 79.
Plot another graph line of the 240 values, this time starting two thirds along (index 160), wrapping back to the beginning when you reach the end until you reach index 159.
Do you notice anything about the curves and their phase relationships?
Then consider what this code might do if you call it repeatedly:
Brian.
Phase1 = starts at the beginning of your table
Phase2 = starts one third of the way along your table
Phase3 = starts two thirds of the way along your table.
Try this:
Plot a graph of the 240 values in your table, it should give a close approximation to a sine wave.
Plot another graph line of the 240 values, this time starting one third along (index 80), wrapping back to the beginning when you reach the end until you reach index 79.
Plot another graph line of the 240 values, this time starting two thirds along (index 160), wrapping back to the beginning when you reach the end until you reach index 159.
Do you notice anything about the curves and their phase relationships?
Then consider what this code might do if you call it repeatedly:
Code:
if(index++ > 79) index = 0;
phase1 = table[index];
phase2 = table[index + 80];
phase3 = table[index + 160];
Brian.