Finding change in a large dataset

5 visualizaciones (últimos 30 días)
Ajay Kumar
Ajay Kumar el 7 de Oct. de 2019
Respondida: Star Strider el 7 de Oct. de 2019
Hello everyone,
I have a data file (1288753x1) as shown above (data attached)
pic.jpg
I am trying to find the y value at the red circles.
I have tried using ischange, but its not working.
Any help would be appreciated. Many Thanks.
  1 comentario
Adam Danz
Adam Danz el 7 de Oct. de 2019
Editada: Adam Danz el 7 de Oct. de 2019
"I have tried using ischange, but its not working."
Nine times out of ten the phrase "its not working" means "I couldn't get it to work". :)
An example in the ischange() documentation is applied to similar step-like data so I'd imagine that it could work for your step function as well. We'd need to see what you tried along with the input data to suggest modifications to the inputs.
But perhaps a lower level solution would be better. If your data are a step function (as appears to be the case) you'd just need to differentiate the x values using diff() and look for differentiated values very close to 0 (if not exactly 0). Perhaps you may need a second requirement that the difference in y should also exceed some threshold at indices where x didn't change.
These lower level approaches are usually easy to implement, quicker than the data processing approaches, easier to understand and write about, and you know exactly what's going on (you could know the precise methods for the data processing approach, too, if you spend the time to investigate).

Iniciar sesión para comentar.

Respuestas (2)

Daniel M
Daniel M el 7 de Oct. de 2019
I agree with what Adam says in that there are certainly more efficient ways to solve this problem. That being said, I didn't have any issue using ischange to find the required values.
load('data')
ch = ischange(rel_P_set_200);
vals = maxk(rel_P_set_200(find(ch)),2);
vals =
0.6468
0.6467

Star Strider
Star Strider el 7 de Oct. de 2019
The ischange function needs to be told what you want it to do.
D = load('Kdata.mat');
y = D.rel_P_set_200;
x = 1:numel(y);
[cp,p] = ischange(y, 'linear', 'MaxNumChanges',4);
cpi = find(cp);
cpis = cpi([1 4]);
figure
plot(y)
hold on
plot(x(cpis), y(cpis), 'p')
hold off
grid
#Finding change in a large dataset - 2019 10 07.png

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by