peak average of consecutive values in a matrix array
Show older comments
Hello, I would like to calculate the average of the peaks (positive and negative values) of consecutive values from a predifined number of elements from a Nx1 matrix, where N is the number of rows. For example, let's say I have a matrix with the following form (24x1):
A[1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24]
I want to obtain the peak and the average for every 5 elements,
B=[mean(peak(1,2,3,4,5)); mean(peak((2,3,4,5,6)); mean(peak((3,4,5,6,7));...........mean(peak((20,21,22,23,24))]
I am chosing every 5 elements to simplify the example. But, this number number of elements can be higher than 100 and the points vary dramatically from positive to negative as they come from acceleration earthquake signals from N higher than 245000.
I would appreciate the help.
6 Comments
Dyuman Joshi
on 19 Jul 2023
Jorge Luis Paredes Estacio
on 19 Jul 2023
Dyuman Joshi
on 19 Jul 2023
"But peaks estimations involve as many peak values (positive or negative) not just one when using movmax."
Can you provide an example for this?
Jorge Luis Paredes Estacio
on 19 Jul 2023
Suppose this is the data in hand -
x = randi([-20 20],1,15)
Assume the moving window is 4, what should be the output in thise case? and what is the logic behind it?
Jorge Luis Paredes Estacio
on 19 Jul 2023
Edited: Jorge Luis Paredes Estacio
on 19 Jul 2023
Accepted Answer
More Answers (0)
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!