Finding start of increase of values in array.

4 次查看(过去 30 天)
Hello everyone,
I am sorry if the title was not clear anought. I have an matrix of 104 collumns (arrays) and n rows (~3000).
Array represent a recorded speed of vehicle from the driving simulator, before and after passing the speed limit sign. I need to find a place when vehicle started and finished speed change.
The problem is, that their speed is not constant before and after but rather slightly oscilates around initial speed and than aroun final speed, thus normal findpeaks, or diff function. My idea is, to find a moment when values of speed increase/decrease for 10 consequtive times in the row, but i have no idea how to code it.
Can you please help me with my task? Or maybe you know better idea how to make it?
I attach picture of my data, and example of the file.
In file:
distance=data (:,3)
speed=data(:,9)
Speed sign is always in the middle of distance.
Thanks in advance for your help

采纳的回答

Walter Roberson
Walter Roberson 2019-1-11
mask=diff(speed).'>0;
strfind([0,mask], [0, ones(1,10)])
putting 0 at the beginning of the mask is to catch the case where the speed up is the very first thing in the array .
  2 个评论
Michal Matowicki
Michal Matowicki 2019-1-12
编辑:Michal Matowicki 2019-1-12
Seems you are my man! Such elegant and simple solution. I have a lot to learn.
However, although this find first change point, it does not tell me where change have finished. Any idea about this?
Thank you many times!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息

产品


版本

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by