Clear Filters
Clear Filters

finding maximum and minimum - See example

1 view (last 30 days)
DP
DP on 25 Oct 2019
Answered: Steven Lord on 25 Oct 2019
clc;
close all;
TT = [ 50 0 136 30 80 59 59 229 59 20 152 69 72 120 36 233 2 8 52 156 20 30 119 5 101 177 50 25 209 33 96 67 68 125 67 100 127 83 95 88];
NN = 1:1:40;
figure (1)
stem (NN,TT);
D = movmean (TT,5);
figure (2)
plot (NN,D)
%% I want to plot figure (2) and smooth sine wave of figure (2) data on one same figure (3).
% and after that I want to find 3 maximum and 2 minmum value that are might
% be same index or a value for figure (2) data and smooth sine wave of figure (2) data
% HELP ME ASAP - PLEASE DO NOT USE findpeaks - MATLAB built-in function
% THANK YOU

Answers (1)

Steven Lord
Steven Lord on 25 Oct 2019
Since you've said you can't use findpeaks, instead use the islocalmin or islocalmax functions. Unlike findpeaks which is part of Signal Processing Toolbox, islocalmin and islocalmax are part of MATLAB.
Or are you not allowed to use findpeaks because this is a homework assignment and the peak / trough detection is something you're supposed to write yourself? If so, islocalmin and islocalmax probably are also forbidden. In this case, show us the code you've written to try to find the local minima / maxima and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

Tags

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!