Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

How to detect a numerical pattern?

1 visualizzazione (ultimi 30 giorni)
Damo Nair
Damo Nair il 4 Feb 2017
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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.

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by