How to obtain an array of maxima from a moving maximum?
Afficher commentaires plus anciens
I would like to get the moving maximum of an array, however I would like the output array to be the same length as the input array and also only place the maximum value for any given window in the same index it was found in the input array. If the next window has the same maximum data point, I would like to input a zero for that index in the output array. An example is below:
A = [4 8 6 1 2 3 1 9 4 5]; % Input data array
windowLength = 3; % Window length for the moving maximum.
The desired output from the example above is:
M = [0 8 6 0 0 3 0 9 0 0];
I tried using both dsp.MovingMaximum and movmax but neither the desired output array.
Réponse acceptée
Plus de réponses (1)
Akshay Dighe
le 3 Nov 2019
0 votes
Hi,
What does the movmax function matlab actually does?
I am not understanding why it is used, please help!
3 commentaires
Image Analyst
le 3 Nov 2019
movmax() slides a window along the vector of numbers and makes an output vector with the max of the values in the window. For example when the max is up against the left edge of the array and the window is 3 elements wide, it will make the first value of the output vector equal to the max of the first three values. The second output value is the max of the values at indexes 2, 3, and 4.
Akshay Dighe
le 3 Nov 2019
Thank you for the answer!
I have as question given by my professor. But I am unable to understand it and do the coding. I understood the theory but to convert it into the code seems difficult.
Can you help me out?
Here is the question

Akshay Dighe
le 3 Nov 2019
Other question

Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!