I have two signals x and y ploted versus time vector t (please refer to
function below). I am trying to create two result vectors named result1 and
The vector result1 should find local peaks (max values). Function
"findpeaks" rejects the inputs since they include negative values so I am
kind a stuck. It should find the local max values and give back the value
and its index.
The vector result2 should give back index of crossing of x and y, where
these are zero (or close to zero). On the chart you can see that not all
crossings of x and y fullfill this condition.
Am I using the "findpeaks" function wrong? Is there a way to accept the
signals with negative values as well?
Thanks andy. The negative parts removal is simple and ideal solution. I feel
so silly, not remembering that myself.
For the second part I have come up to defining zerocrossing t values for
both signals separately. Now I would need to crossreference them and leave
in result2 only those who are the same in both vectors (indx and indy).
Am 24.02.21 um 19:23 schrieb Blaz:
> For the second part I have come up to defining zerocrossing t values for
> both signals separately. Now I would need to crossreference them and leave
> in result2 only those who are the same in both vectors (indx and indy).
> result2 = ??
The first step is always to read the documentation clearly. This is
written in the help of the function
Tells the function that data takes positive and negative
values. The base-line for the peaks is taken as the mean
value of the function. This is equivalent as passing the
absolute value of the data after removing the mean.
Also check the demos (none with negative data, but shows other aspects
of the function)