Program to output zero point crossing

Good Evening All and Merry Christmas!

I am currently working to produce a program to output the zero point crossing time of a sin waveform given a set of input data.

Basically , I am looking to calculate the zero point crossing time of any input sin wave, when I am given a set of data containing amplitudes and corresponding times of the wave. The input data would be an excel file(or text file) containing a list of amplitudes and corresponding time values for a sinusoidal wave. e.g. :

a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10

t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10

I have been producing pseudocode for the task which works under the premise of : 'given an input amplitude a at time t, and the 'next' amplitude a+1 at time t+1 , if the sign of a is different from a+1, then the wave must have crossed the zero point,so run a function to calculate the zero point crossing time, tz.

If however, the sign of a and a+1 are the same,then the wave has not passed the zero mark, so move on to the next input values.
I have worked out the mathematics to calculate the zero point crossing, however I am stuck in figuring out the code to input the values from a file.
My question is basically ' If I am given a file which contains a list of amplitude values and time values, how do I program to read in 2 of these values at a time , and run my functions to calculate the zero point crossing if applicable. If not, how do I move on to the next values? ie a0 -> a1, a1 -> a2 and t0 -> t1, t1 -> t2.

Any help would be greatly appreciated!
Topic archived. No new replies allowed.