How do I determine the start and end of the wave?

I am facing a bit of a challenge in trying to understand basic concepts or terms within the signal world.

I have a number of values retrieved from a sampled signal that is generated randomly for no specific purpose:

Seconds,      Volts
0,            0
3.702834E-08, 0.09484652
7.405668E-08, 0.1872366
1.11085E-07, 0.2747773
1.481134E-07, 0.3552014
1.851417E-07, 0.426426
2.2217E-07, 0.4866064
2.591984E-07, 0.5341839
2.962267E-07, 0.5679263
3.332551E-07, 0.5869598
3.702834E-07, 0.5907913
4.073117E-07, 0.5793217
4.443401E-07, 0.5528479
4.813684E-07, 0.5120556
5.183967E-07, 0.4580013
5.554251E-07, 0.392085
5.924534E-07, 0.3160141
6.294817E-07, 0.2317585
6.665101E-07, 0.1415004
7.035384E-07, 0.04757757
7.405668E-07, -0.04757759
7.775951E-07, -0.1415004
8.146235E-07, -0.2317585
8.516518E-07, -0.3160141
8.886801E-07, -0.3920851
9.257085E-07, -0.4580014
9.627369E-07, -0.5120556
9.997651E-07, -0.5528478
1.036793E-06, -0.5793217
1.073822E-06, -0.5907913
1.11085E-06, -0.5869598
1.147878E-06, -0.5679264
1.184907E-06, -0.5341839
1.221935E-06, -0.4866063
1.258963E-06, -0.4264261
1.295992E-06, -0.3552014
1.33302E-06, -0.2747772
1.370049E-06, -0.1872364
1.407077E-06, -0.09484658
1.444105E-06, 1.807601E-08
1.481134E-06, 0.09484661
1.518162E-06, 0.1872365
1.55519E-06, 0.2747773
1.592219E-06, 0.3552015
1.629247E-06, 0.4264261
1.666275E-06, 0.4866063
1.703304E-06, 0.5341839
1.740332E-06, 0.5679264
1.77736E-06, 0.5869598
1.814389E-06, 0.5907913
1.851417E-06, 0.5793217
1.888445E-06, 0.5528478
1.925474E-06, 0.5120555
1.962502E-06, 0.4580013
1.99953E-06, 0.3920853
2.036559E-06, 0.3160139


The list goes on to contain more and more values.

I was asked to calculate the frequency of the highest amplitude wave, finding the highest amplitude is not the problem. My problem is once I found the highest amplitude, how do I determine the start and end of the wave (not quite sure if the wave length is what I should be after)

Also can you confirm whether a wave form can contain more than one frequency?

Any clarification would be much appreciated!

• You probably want to read about FFT May 25, 2016 at 14:08
• This might be more on-topic at Signal Processing. May 25, 2016 at 14:11
• Why do you want to find the start and end of the wave? Knowing what you want the results for will help us give you a better answer. May 25, 2016 at 14:31
• @ThePhoton to calculate the frequency of the wave, am I taking the wrong approach? I am actually writing a programme that automatically read from the above file and calculate the frequency of the highest amplitude wave! May 25, 2016 at 14:34
• @feetwet, I think this is a bit basic for DSP.SE. We should be able to give an adequate answer here. (OP, For more detail on the "sophisticated" methods I mention in my answer, probably DSP is a better place to search and/or ask) May 25, 2016 at 16:02

2 Answers

Also can you confirm whether a wave form can contain more than one frequency?

Yes. This is the basis of Fourier analysis. Any periodic signal (finite-powered) can be decomposed into a sum of sinusoids. We conversationally say the signal has content or power at all of the frequencies of the sinusoids needed to construct the signal.

My problem is once I found the highest amplitude, how do I determine the start and end of the wave

If you are trying to find the period (or frequency) of the signal, you are asking about spectral estimation.

A very simple technique is not to find the "start" and "end" of the wave, but rather to find the zero crossings (after removing any dc components). Since each period of the signal will have two zero crossings, you can count some (odd) number $N$ of crossings at times $T_1...T_N$, and get the average period over that sample as $$\frac{2(T_N-T_1)}{N-1}$$ Depending how precisely you need to estimate the period (and what sampling rate you sampled the signal at) you may want to use some interpolation between the samples to get good estimates of the zero-crossing times.

A (slightly) more sophisticated method is to make a periodogram. This essentially means taking the Fourier transform of the signal (by some numerical method, such as the FFT), and looking for peaks in the spectrum. If the signal is well behaved, the lowest-frequency (non-dc) peak will correspond to the fundamental frequency of the signal.

The periodogram is actually not a particularly good method to find the fundamental frequency, but numerous more sophisticated methods (mentioned in the Wiki article) refine it to improve the ability to estimate the signal frequency.

This is how I would approach this problem.

First I'd remove the DC component and then take an FFT and zero pad it out to about 2^13.

In Matlab, X = fft( x-mean(x), 8192 );

Then I'd find the maximum points.

In Matlab, find( abs( X ) == max( abs( X ) ) )

I get 421. This means that the maximum frequency is the sampling frequency (I estimate 2.7006 MHz from the timestamps) * 420 / 8192 = 1.3846 MHz

The amplitude is 2 * abs(X(421))/56 (56 comes from the length of the dataset) = 0.2462

Incidentally, the phase is angle( X( 421 ) ) = 3.1055 radians, and you can plot abs( X( 421 ) ) * 2 / 56 * cos( 2 * pi * 420 * fs / 8192 * t + angle( X( 421 ) ) )