How to find the values of jump in an array?

18 vues (au cours des 30 derniers jours)
waqas
waqas le 22 Juin 2019
I am trying to find the displacement jump from an array where I want to get the values at the locations highlighted in the attached image. Annotation 2019-06-23 005128.png
Following the array that I currently have for now:
v = [0 0.128669530153275 0.130120709538460 0.134193837642670 0.106409639120102 0.0963872149586678 0.0900304913520813 0.0918694287538528 0.0891467630863190 0.0845631361007690 0.0796448960900307 0.0774808377027512 0.0832534655928612 0.0903223231434822 0.0791355073451996 0.0867500454187393 0.0822556465864182 0.0834708511829376 0.0809724852442741 0.0769125446677208 0.0762052312493324 0.0814182013273239 0.0824952796101570 0.0871148481965065 0.0828126743435860 0.0934268161654472 0.100223250687122 0.105054035782814 0.101684793829918 0.0938292965292931 0.0913284420967102 0.0830449163913727 0.0823436081409454 0.0801921039819717 0.0739008858799934 0.0733054578304291 0.0756217613816261 0.0752388313412666 0.0852720662951469 0.0937606021761894 0.102765440940857 0.113776959478855 0.114458248019218 0.119862981140614 0.126136168837547 0.130058258771896 0.134705126285553 0.135741069912910 0.143991172313690 0.141014173626900 0.149323135614395 0.139213815331459 0.116455316543579 0.0450247861444950 -0.0422766618430615 -0.133420765399933 -0.196351751685143 -0.255337893962860 -0.268517315387726 -0.271409779787064 -0.272508561611176 -0.272525668144226 -0.270379871129990 -0.270709663629532 -0.271532326936722 -0.269337981939316 -0.277245104312897 -0.275981307029724 -0.279530405998230 -0.281473547220230 -0.279926627874374 -0.279666334390640 -0.288220971822739 -0.280666559934616 0];
There are in total more than 3000 files in total with same trend that I want to observe and it is quite possible that maxima or minima is not always just at the start of or end of prominent jump as shown in figure. Any help regarding this is highly appreciated.
Cheers,

Réponse acceptée

Rik
Rik le 22 Juin 2019
There are several ways to solve this. Below you find a way to look over a few samples where there is a big jump. Another option would be to do a movmean on the diff and then find the biggest jump.
v = [0 0.128669530153275 0.130120709538460 0.134193837642670 0.106409639120102 0.0963872149586678 0.0900304913520813 0.0918694287538528 0.0891467630863190 0.0845631361007690 0.0796448960900307 0.0774808377027512 0.0832534655928612 0.0903223231434822 0.0791355073451996 0.0867500454187393 0.0822556465864182 0.0834708511829376 0.0809724852442741 0.0769125446677208 0.0762052312493324 0.0814182013273239 0.0824952796101570 0.0871148481965065 0.0828126743435860 0.0934268161654472 0.100223250687122 0.105054035782814 0.101684793829918 0.0938292965292931 0.0913284420967102 0.0830449163913727 0.0823436081409454 0.0801921039819717 0.0739008858799934 0.0733054578304291 0.0756217613816261 0.0752388313412666 0.0852720662951469 0.0937606021761894 0.102765440940857 0.113776959478855 0.114458248019218 0.119862981140614 0.126136168837547 0.130058258771896 0.134705126285553 0.135741069912910 0.143991172313690 0.141014173626900 0.149323135614395 0.139213815331459 0.116455316543579 0.0450247861444950 -0.0422766618430615 -0.133420765399933 -0.196351751685143 -0.255337893962860 -0.268517315387726 -0.271409779787064 -0.272508561611176 -0.272525668144226 -0.270379871129990 -0.270709663629532 -0.271532326936722 -0.269337981939316 -0.277245104312897 -0.275981307029724 -0.279530405998230 -0.281473547220230 -0.279926627874374 -0.279666334390640 -0.288220971822739 -0.280666559934616 0];
long_diff=@(x,k) x((1+k):end)-x(1:(end-k));
k=5;%define window size
a=long_diff(v,k);
[~,b]=max(abs(a));
v2=v(b+(-k:k));
jump_size=max(v2)-min(v2);

Plus de réponses (1)

Steven Lord
Steven Lord le 23 Juin 2019
Use the ischange function.

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by