04-23-2010 07:13 AM
Hi,
I have to detect the Peaks of a signal in a ScatterGraph. I have the signal created, in this case, the following signal:
double[] signal = new double[3200];
double[] x = new double[3200];
Random aleatorio = new Random();
for (int i=0; i< 3200; i++)
{
signal[i] = 0.74 * aleatorio.Next(5);
x[i] = i;
}
scatterPlot1.PlotXY(x,signal);
With this Example, I detect the Peaks with the following code:
PeakPolarity peakPolarity = PeakPolarity.Peaks;
PeakDetector pkd = new PeakDetector(0.5, 3, peakPolarity);
pkd.Detect(this.signal, false, out this.amplitudesPeak, out this.locationsPeak, out secondDerivativesPeak);
scatterPlotPeaks.PlotXY(locationsPeak, amplitudesPeak);
Where this.signal is the previous signal which I have generated.
The problem is: The Peaks which are plotting in the Graph don't coincide with the real peaks of this.signal.
¿Why??
Thanks,
04-29-2010 04:19 AM
Hi,
Could you post the full project?
Thanks!
06-05-2013 03:13 AM - edited 06-05-2013 03:19 AM
Hi,
Just use "Reset" with the same parameters before any call to "Detect".
// loop
// {
pkd.Reset(0.5, 3, peakPolarity);
pkd.Detect(this.signal, false, out this.amplitudesPeak, out this.locationsPeak, out secondDerivativesPeak);
scatterPlotPeaks.PlotXY(locationsPeak, amplitudesPeak);
// }
Regards
Iñaki Gauna