Averaging array, checking conditional, and increment average points.

3 views (last 30 days)
Daniel Koziel
Daniel Koziel on 25 Sep 2019
Commented: KALYAN ACHARJYA on 25 Sep 2019
I am attempting to solve the following issue that I wrote in a step sequence:
1 - I have an array of 250 points and I want to take the average of the 1st 10 points.
2 - If the 11th point in the 250 point array is 1.25x bigger than the average -----> I want to look at the 12th point in the array to see if this value is larger than the 11th point (and so on).
2b - If the next point is no longer larger, I want to save the maximum point.
3 - If the next point outside of the 10 point average is not 1.25x bigger, I want to remove the first point of the average, and add the next point in the array:
Ex. 1st average (1 through 10) ----> check 11th point to see if 1.25x bigger ----> no: average (2 through 11) ----> check 12th point to see if 1.25x larger ----> yes: check 13th point to see if greater than or equal to 12th point ------> yes: check 14th point to see if greater than or equal to 13th point ----> no: store 13th point.
Once the maximum point is found, restart the array averaging at the maximum point.
I am new to Matlab and struggling with this issue.
Thank you!
  1 Comment
KALYAN ACHARJYA
KALYAN ACHARJYA on 25 Sep 2019
Check here, suggested you to try yourself,it's easy, I am sure, you can. Any issue we are here to help you.
Good Luck!

Sign in to comment.

Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by