MATLAB: How to change the maker for the ‘findpeaks’ function


Is there any way to change the blue inverted triangle generated by the 'findpeaks' function to a red inverted triangle?

Best Answer

  • From the documentation, it seems that findpeaks does not directly support changing marker. You will need to do it in two steps. First, find the height and location of peaks and then use plot() to draw create the peaks according to your own specifications. See this example:
    Something like this
    x % x-value of signal
    y % y-values of signal
    [pk, loc] = findpeaks(y, x);
    plot(x,y,'-', loc, pk, 'vr')