Azzera filtri
Azzera filtri

findpeaks function returns empty

20 visualizzazioni (ultimi 30 giorni)
ZENONG
ZENONG il 3 Set 2023
Hi, I am using findpeaks function to locate peaks, but sometimes it returns empty. what happened and how this functions works.
untitled
pks = 0×1 empty double column vector
dbtype untitled
1 clc 2 fs = 2.5*10^(9); 3 T = 1/fs; 4 5 for d=1:1 6 for k1=2:2 7 k2=k1+10; 8 csvfn1=sprintf('tek00%02dALL.csv',k1); 9 csvfn2=sprintf('tek00%02dALL.csv',k2); 10 data1=readtable(csvfn1,... 11 'Range','C22:C100021',... 12 'ReadVariableNames',false); 13 data2=readtable(csvfn2,... 14 'Range','C22:C100021',... 15 'ReadVariableNames',false); 16 17 c=2300; 18 a=3000; 19 b=a+c*d; 20 21 range=a:b; 22 L=b-a; 23 t = (0:L-1)*T; 24 25 y=data1{range,1}; 26 y=lowpass(y,2*10^6,fs); 27 Y = fft(y,L); 28 29 y1=data2{range,1}; 30 y1=lowpass(y1,2*10^6,fs); 31 Y1 = fft(y1,L); 32 33 Crs=ifft(Y1.*conj(Y)); 34 [pks, ~]=findpeaks(Crs,fs) 35 36 end 37 end

Risposta accettata

MYBLOG
MYBLOG il 3 Set 2023
The findpeaks function in MATLAB is used to locate peaks in a signal. It works by analyzing the input signal and identifying points where the signal transitions from increasing to decreasing, indicating the presence of a peak. However, there can be situations where findpeaks returns an empty result, such as in your case.
Here are some possible reasons why findpeaks may return an empty result:
  1. No Peaks in the Signal: If there are no distinct peaks in the signal or if the peaks are not pronounced enough, findpeaks may not detect any peaks and return an empty result.
  2. Threshold Settings: findpeaks has several optional parameters that allow you to set thresholds for peak detection, such as specifying a minimum peak height, minimum peak distance, or minimum peak prominence. If your signal doesn't meet these criteria, it might not detect any peaks.
  3. Noise in the Signal: If your signal contains a significant amount of noise, it can interfere with peak detection. In such cases, you may need to preprocess the signal to reduce noise or adjust the findpeaks parameters accordingly.
  4. Incorrect Usage: Make sure you are using the findpeaks function correctly, including providing the correct input data and specifying the appropriate parameters.
If you want to learn more about the findpeaks function, make sure to check out the official MATLAB documentation on the topic: MATLAB Documentation or The findpeaks Function in MATLAB: Detecting Peaks in Data.
  3 Commenti
ZENONG
ZENONG il 3 Set 2023
Modificato: ZENONG il 3 Set 2023
Thank you! Is there a way to locate not the peak point but the maximum value point?
Walter Roberson
Walter Roberson il 3 Set 2023
findpeaks(abs(Crs)) ... but I suspect instead you would prefer to findpeaks(-Crs) and merge that with findpeaks(Crs)

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by