MATLAB Answers

how to find and mark the value of local minimums in a graph of multiple data ?

1 view (last 30 days)
reema shrestha
reema shrestha on 15 Feb 2018
Answered: Chris Turnes on 15 Feb 2018
I have a graph of multiple data taken experimentally. Now I want to find the troughs of the graph. I want to show the value of local minimas in the graph. How do I do it?

  0 Comments

Sign in to comment.

Accepted Answer

Birdman
Birdman on 15 Feb 2018
Try this:
x=randi([1 7],1,10);
y=randi([3,10],1,10);
plot(x);hold on;plot(y);
[~,idxX]=findpeaks(-x);
[~,idxY]=findpeaks(-y);
plot(idxX,x(idxX),'o');plot(idxY,y(idxY),'o')
hold off;

More Answers (1)

Chris Turnes
Chris Turnes on 15 Feb 2018
If you have access to R2017b, you might also consider checking out the islocalmin function.

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags