I want to apply this code some interval of data
envelope(data,1,'peak')
[peakHeights,valleyHeights] = envelope(data,1,'peak')
vi = sum(peakHeights-valleyHeights)
[peakHeights, indexesOfPeaks] = findpeaks (data);
[valleyHeights, indexesOfValleys] = findpeaks (data);
fi = numel(indexesOfPeaks) + numel(indexesOfValleys)
for example
if data set is [ 1 2 3 4 4 3 5 3 2 3 5 6 7 7 3 5 6 7 1 9 2 4 6 7 8 8 4 3 2 2 5 5 ]
i want apply this code some interval (if 3 column ) like [1 2 3], [2 3 4], [3 4 4], [4,4,3].....[2 5 5] moving forward 1 colmumn.
so, i want to know how to apply code to some interval ( in here 3 column) in moving 1 column forward.
please let me know, thank you

 Réponse acceptée

Ameer Hamza
Ameer Hamza le 14 Oct 2020
You can write a for-loop
x = [ 1 2 3 4 4 3 5 3 2 3 5 6 7 7 3 5 6 7 1 9 2 4 6 7 8 8 4 3 2 2 5 5 ];
n = 3;
for i = 1:numel(x)-n+1
xi = x(i:i+2); % n-element vector
% process xi
end

Plus de réponses (0)

Catégories

En savoir plus sur Fourier Analysis and Filtering 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!

Translated by