Info

此问题已关闭。 请重新打开它进行编辑或回答。

How to detect a numerical pattern?

1 次查看(过去 30 天)
Damo Nair
Damo Nair 2017-2-4
关闭: MATLAB Answer Bot 2021-8-20
Hi,
I have a data set that has 2 columns, states & prices. Like this ...
prices = [-1.5 -1.2 -2 -2.4 -1.3 -0.2 -0.6 -0.6 0.8 1.8 2.4 2 1.9 1.88 3 3.7 4.2 4.1
4.5 3.3 3.5 2.6 1.5 1.4 1.7 1.6 2.4 2.9 3.4 3.3 3.8 2.9 2 1.8 1.5];
states = [1 2 1 1 2 2 2 2 2 4 4 4 3 2 4 4 4 4 4 4 4 2 2 2 2 2 4 4 4 4 4 2 2 2 2];
Now, after the last lowest state, i.e. 1 the prices move up, move down, go back up etc.
My question how can I detect these up & down moves with respect to state 1?
Right now I'm using really cumbersome commands like
f1 = find(t1(:,2) == 1, 1, 'last') &
fm = find(t1(:,1) == max(t1(:,1)) & t1(:,1) > f1) & run length on price difference.
And am not getting anywhere. Any easier, quicker way to detect these up & down moves?
Thanks
Damo.

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by