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.