{"id":42109322,"url":"https://github.com/pucicu/rp","last_synced_at":"2026-05-29T14:00:43.840Z","repository":{"id":94357530,"uuid":"168683835","full_name":"pucicu/rp","owner":"pucicu","description":"MATLAB scripts to create recurrence plots and to perform recurrence quantification analysis.","archived":false,"fork":false,"pushed_at":"2026-03-05T22:44:42.000Z","size":212,"stargazers_count":12,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-06T02:11:31.232Z","etag":null,"topics":["recurrence-analysis","recurrence-plot","recurrence-quantification","time-series-analysis"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pucicu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-02-01T10:51:29.000Z","updated_at":"2026-03-05T22:44:45.000Z","dependencies_parsed_at":"2025-04-12T03:52:43.389Z","dependency_job_id":"1dab1769-509f-40d1-b7cf-e808bc853e67","html_url":"https://github.com/pucicu/rp","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/pucicu/rp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pucicu%2Frp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pucicu%2Frp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pucicu%2Frp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pucicu%2Frp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pucicu","download_url":"https://codeload.github.com/pucicu/rp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pucicu%2Frp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33655441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["recurrence-analysis","recurrence-plot","recurrence-quantification","time-series-analysis"],"created_at":"2026-01-26T13:31:27.989Z","updated_at":"2026-05-29T14:00:43.833Z","avatar_url":"https://github.com/pucicu.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Recurrence Plot \u0026 Quantification\n\n[![Build Status](https://app.travis-ci.com/pucicu/rp.svg?token=hKEEpRYLtZYztWCNP4Gt\u0026branch=master)](https://app.travis-ci.com/pucicu/rp)\n![commits](https://badgen.net/github/release/pucicu/rp)\n[![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/pucicu/rp/)](https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/pucicu/rp)\n![commits](https://badgen.net/github/license/pucicu/rp)\n\n\n\nSimple MATLAB functions for calculating recurrence plots and recurrence quantification.\n\n## Functions\n\n### EMBED\n\nCreates embedding vector using time delay embedding.\n\n#### Syntax\n\n`Y=EMBED(X,M,T)` creates the embedding vector `Y` from the time\nseries `X` using a time delay embedding with dimension `M` and\ndelay `T`. The resulting embedding vector has length `N-T*(M-1)`,\nwhere `N` is the length of the original time series.\n\n#### Reference\n\n* Packard, N. H., Crutchfield, J. P., Farmer, J. D.,\n  Shaw, R. S. (1980). Geometry from a time series.\n  Physical Review Letters 45, 712-716.\n\n#### Example\n\n```matlab\nN = 300; % length of time series\nx = .9*sin((1:N)*2*pi/70); % exemplary time series\ny = embed(x,2,17); % embed into 2 dimensions using delay 17\nplot(y(:,1),y(:,2))\n```\n\n--------------------------------------------------------------\n\n### RP\n\nCalculates a recurrence plot.\n\n#### Syntax\n\n`R=RP(X,E,THRESH,NORM,ALG)` calculates the recurrence plot `R`\nfrom an embedding vector `X` and using the threshold `E`.\n`X` is a `N`-by-`M` matrix corresponding to `N` time points\nand `M` embedding dimensions.\n\n`[R,D]=RP(...)` outputs the recurrence plot `R` and the\nunderlying distance matrix `D`.\n\n**Optional arguments:**\n\n`NORM` - is a string setting the norm for distance\n                 calculation in phasespace. Can be `'euc'`\n                 for euclidian norm (default) or `'max'`\n                 for maximum norm.\n\n`ALG` - is a string specifying the algorithm of\n                 calculating the distance matrix. Can be\n                 `'loops'`, `'vector'` (default), or\n                 `'matlabvector'`.\n\n`THRESH` - is a string that specifies how the threshold\n                 epsilon will be calculated. With `'fix'` (default)\n                 the RP is computed with a fixed threshold\n                 epsilon specified by the input parameter `E`.\n                 With `'var'` the RP is computed with a fixed\n                 threshold epsilon, which corresponds to the\n                 lower '`E`'-quantile (specified by `E`) of the\n                 distance distribution of all points in\n                 phasespace. With `'fan'` the RP is computed with\n                 a variable threshold resulting in a fixed amount\n                 of nearest neighbours in phasespace, specified\n%                by the fraction `E` of recurrence points\n\n#### Reference\n\n* Marwan, N., Romano, M. C., Thiel, M., Kurths, J. (2007).\n  Recurrence plots for the analysis of complex systems.\n  Physics Reports, 438, 237-329.\n* Kraemer, K. H., Donner, R. V., Heitzig, J., \u0026 Marwan, N.\n  (2018). Recurrence threshold selection for obtaining robust\n  recurrence characteristics in different embedding dimensions.\n  Chaos, 28, 085720.\n\n#### Example\n\n```matlab\nN = 300; % length of time series\nx = .9*sin((1:N)*2*pi/70); % exemplary time series\nxVec = embed(x,2,17); % embed into 2 dimensions using delay 17\nR = rp(xVec,.1,'fix','max'); % calculate RP using maximum norm and fixed threshold\nimagesc(R)\n```\n\n--------------------------------------------------------------\n\n### RP_ISO\n\nCalculates the isodirectional recurrence plot\n\n#### Syntax\n\n`R=RP_ISO(X,E,W)` calculates the isodirectional recurrence plot `R`\nfrom an embedding vector `X` and using the threshold `E` for the\nvector distances and threshold `W` for the angle to be\nconsidered as isodirectional.\n\n`R=RP_ISO(X,E,W,TAU)` estimates tangential vector using time delay `TAU`.\n\n#### Example\n\n```matlab\n[t x] = ode45('lorenz',[0 100],[-6.2 -10 14]);\n[R1, SP, R0] = rp_iso(x(3000:5000,:),10,.2);\n\nnexttile\nimagesc(R0) % regular RP\naxis square\n\nnexttile\nimagesc(R1) % isodirectional RP\naxis square\n```\n\n--------------------------------------------------------------\n\n### RP_PERP\n\nCalculates the perpendicular recurrence plot\n\n#### Syntax\n\n`R=RP_PERP(X,E,W)` calculates the perpendicular recurrence plot `R`\nfrom an embedding vector `X` and using the threshold `E` for the\nvector distances and threshold `W` for the angle to be\nconsidered as perpendicular.\n\n`R=RP_PERP(X,E,W,TAU)` estimates tangential vector using time delay `TAU`\n(works only if condition in line 95 is set to 0).\n\n#### Example\n\n```matlab\n[t x] = ode45('lorenz',[0 100],[-6.2 -10 14]);\n[R1, SP, R0] = rp_perp(x(3000:5000,:),10,.25);\n\nnexttile\nimagesc(R0) % regular RP\naxis square\n\nnexttile\nimagesc(R1) % perpendicular RP\naxis square\n```\n\n--------------------------------------------------------------\n\n### RQA\n\nCalculates recurrence quantification analysis.\n\n#### Syntax\n\n`Q=RQA(R,L,T)` calculates measures of recurrence\nquantification analysis for recurrence plot `R` using\nminimal line length `L` and a Theiler window `T`.\n\n**Output:**\n\n* `Y(1) = RR`     (recurrence rate)\n* `Y(2) = DET`    (determinism)\n* `Y(3) = \u003cL\u003e`    (mean diagonal line length)\n* `Y(4) = Lmax`   (maximal diagonal line length)\n* `Y(5) = ENTR`   (entropy of the diagonal line lengths)\n* `Y(6) = LAM`    (laminarity)\n* `Y(7) = TT`     (trapping time)\n* `Y(8) = Vmax`   (maximal vertical line length)\n* `Y(9) = RTmax` (maximal white vertical line length)\n* `Y(10) = T2`     (recurrence time of 2nd type)\n* `Y(11) = RTE`    (recurrence time entropy, i.e., RPDE)\n* `Y(12) = Clust`  (clustering coefficient)\n* `Y(13) = Trans`  (transitivity)\n\n#### Reference\n\n* Marwan, N., Romano, M. C., Thiel, M., Kurths, J. (2007).\n  Recurrence plots for the analysis of complex systems.\n  Physics Reports, 438, 237-329.\n* Marwan, N., Donges, J. F., Zou, Y., Donner, R. V.,\n  Kurths, J. (2009). Complex network approach for recurrence\n  analysis of time series. Physics Letters A, 373, 4246-4254.\n\n#### Example\n\n```matlab\nN = 300; % length of time series\nx = .9*sin((1:N)*2*pi/70); % exemplary time series\nxVec = embed(x,2,17);\nR = rp(xVec,.1);\nY = rqa(R);\n```\n\n--------------------------------------------------------------\n\n### DL_CENSI\n\nMean of the diagonal line lengths and their distribution \nusing the specific correction schema for border lines \nproposed by Censi et al. 2004.\n\n#### Syntax\n\n`[A B]=DL_CENSI(R)` computes the mean `A` and the lengths of the\nfound diagonal lines of the recurrence plot `R`, stored in `B`,\nusing the Censi correction schema. In order to get the histogramme\nof the line lengths, simply call `HIST(B,[1 MAX(B)])`.\n\n#### Example\n\n```matlab\na = sin(linspace(0,5*2*pi,1050));\nR = crp(a,2,50,.2,'nonorm','nogui');\n[l l_dist] = dl_censi(R); % apply Censi correction for border lines\nhist(l_dist,200)\ntitle('Censi correction')\n```\n\n--------------------------------------------------------------\n\n### LACUNARITY\n\nCompute lacunarity measures for a binary or grayscale image.\n\n#### Syntax\n\n`[L, LNORM, LSHUFFLED] = LACUNARITY(X, BOXSIZE)` computes the \nlacunarity of the input matrix `X` for all box sizes specified in\n`BOXSIZE`\n\n\n#### Example\n\n```matlab\nX = rand(2000) \u003e 0.7;\nboxSize = 2:500;\nL = lacunarity(X, boxSize);\n\nloglog(boxSize, L)\nxlabel('Box size')\nylabel('Lacunarity')\n```\n\n--------------------------------------------------------------\n\n## Application\n\nPart of this code was used in the study\n\n* M. H. Trauth, A. Asrat, W. Duesing, V. Foerster, K. H. Kraemer, N. Marwan, M. A. Maslin, F. Schaebitz: _Classifying past climate change in the Chew Bahir basin, southern Ethiopia, using recurrence quantification analysis_, Climate Dynamics, 53(5), 2557–2572 (2019). DOI:[10.1007/s00382-019-04641-3](https://doi.org/10.1007/s00382-019-04641-3)\n* N. Marwan, T. Braun, J. Kurths: _A Synergetic Perspective of Analyzing Phase Space Dynamics: The Crucial Role of Recurrence_, European Physical Journal Special Topics (in review).\n\n## How to cite\n\n* Use the citation provided by Zenodo \u003chttps://zenodo.org/record/6325324\u003e\n\n## Background\n\nread more about recurrence plot analysis at\n\u003chttp://www.recurrence-plot.tk/\u003e\n\n## License\n\n(see LICENSE file)\n\nCopyright 2016-2026,\nPotsdam Institute for Climate Impact Research (PIK),\nInstitute of Geosciences, University of Potsdam,\nK. Hauke Kraemer, Norbert Marwan, Martin H. Trauth\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpucicu%2Frp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpucicu%2Frp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpucicu%2Frp/lists"}