I have an array of data [ 1.1 0.5 1.8 2.5 0.6 2.0 2.1 4.0 1.3 1.4 5.0 4.2 2.2 3.2 3.4 3.5 3.3 4.8 1.11 2.0 2.5] I need a code pick data points incrementally from 1.1 until it gets to the peak then start selecting after the peak in decreasing order. The expected outcome is [ 1.1 1.8 2.5 4.0 5.0 4.2 2.2 1.11] starting from the first element (1.1) the next element is 1.8 dropping 0.5 until getting to the peak (5.0) and then start decreasing from 5.0 to 1.11. the number of elements in the final output will reduce.
MATLAB: I have an array of data [ 1.1 0.5 1.8 2.5 0.6 2.0 2.1 4.0 1.3 1.4 5.0 4.2 2.2 3.2 3.4 3.5 3.3 4.8 1.11 2.0 2.5] I need a code pick data points incrementally from 1.1 until it get to the peak then start selecting after the peak in deceasing order.
Related Question
- Generating linear array [0 -1 0 1 -2 -1 0 1 2 ……]
- Putting the combinations of a sequence in an cell array
- What does M([1:1 2:3], [1:0 2:3]) mean
- Given a=[1 2 3 4 5], generate m=[2 1 3 4 5; 2 3 1 4 5; 2 3 4 1 5; 2 3 4 5 1; 1 3 2 4 5; 1 3 4 2 5; 1 3 4 5 2; 1 2 4 3 5; 1 2 4 5 3; 1 2 3 5 4].
- 1:2:10100:-25:0 gives 1, how
Best Answer