Hi Sara Bitarafan
please have a look at the attached script. .
clear all;clc;close all
center signal, closest to dominant cycle to a sin cos signal
plot(t,s);grid on;axis tight
For this sample there's not much DC, but it may the case that without removing DC the sought eye diagram is difficult to get.
Calculating the dominant cycle with fft:
2nd value is just FFT mirror
If n_maxS = max_amount_cycles this would be the highest discernible requency, with the FFT: it would be just 2 time samples per cycle.
n_maxS: amount of cycles
nT: amount of samples per dominant cycle:
dominant cycle T
amount of lost samples ignoring .2
instead of a for loop:
But the dominant cycle is not that constant.
For the same basic cycle t(nT) we see 1,2 and 3 peaks
This is caused by a 2nd tone almost half way the dominant tone in amplitude and really close to the dominant.
fft approach is more reliable when there's a clear frequency peak but no high tones anywhere, particular near the dominant.
Yet the variable nT is going to be useful in next point.
Also, assuming the single action potential refers to a single peak
When the dominant cycle is not that constant we can use squelch:
Set a threshold that includes all peaks above a given amplitude.
avoid false peaks imposing min distance between found peaks, that may be for instance: nT
So far what can we assert about this signal and the 'potential' events you have mentioned in the question?
How often do the events take place
How much jitter suffer such events understanding jitter ~ standard deviation of locs
Plotting the centered diagram with all events:
Let be dt the + - span left and right of each peak event
And the eye diagram:
if locs(k)<numel(t)-dt && locs(k)>dt
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance for time and attention