Finding change in a large dataset

4 ビュー (過去 30 日間)
Ajay Kumar
Ajay Kumar 2019 年 10 月 7 日
回答済み: Star Strider 2019 年 10 月 7 日
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 件のコメント
Adam Danz
Adam Danz 2019 年 10 月 7 日
編集済み: Adam Danz 2019 年 10 月 7 日
"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).

サインインしてコメントする。

回答 (2 件)

Daniel M
Daniel M 2019 年 10 月 7 日
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 2019 年 10 月 7 日
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

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by