I am writing a function, which cannot use the findpeaks or islocalmax, to plot all the maximum values on a graph. However with my if loop it plots each maximum value on a different figure
How do I display them all on one figure? Help very much appreciated.
Here is my function:
function [k] = Peak(X,Y)for k = 2:length(Y)-1if (Y(k) > Y(k-1) & Y(k) > Y(k+1) & Y(k) >100) figure plot(X,Y,X(k),Y(k),'r*')endend end
Best Answer