function MsPplots(X,scales,scstep,nrow,ncol,save) %MSP function creates an ensemble of Poincar? Plots, one for each %coarse grained time series % %MSP function requires dscatter.m and CoarseGrain.m functions. % %MSP was tested on Matlab_R2010b and Matlab_R2014b % %input: %X - a time series vector with one column. %scales - the number of time scales. (integer; default: 12) %scstep - Poicare plots from 1 to scale by scstep. (integer - default: 1) %nrow - number of rows in the plot montage. (integer; default: 3) %ncol - number of columns in the plot montage. (integer; default: 4) %save - True (default: 1) if you want to save figure as Figure1.jpg % %% Copyright (C) 2016 Teresa Henriques (teresa.henriques@wyss.harvard.edu) % and A Burykin (burykin@gmail.com) % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % any later version. % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see . if (~isvector(X) || ~isnumeric(X)) %verify if X is a numeric vector msg = 'X must be a numeric vector'; error(msg); end if (nargin<2 || isempty (scales)) %define default number of scales scales=12; end if (nargin<3 || isempty (scstep)) %define default scale step scstep=1; end S0=1:scstep:scales; if (nargin<4 || isempty (nrow)) %define default number of rows nrow=3; end if (nargin<5 || isempty (ncol)) %define default number of columns ncol=4; end if (nargin<6 || isempty (save)) %define save default save=1; end if(~isnumeric(scales) || mod(scales,1) ~= 0) msg = 'scales must be an integer'; error(msg); end if(~isnumeric(scstep) || mod(scstep,1) ~= 0) msg = 'scales step must be an integer'; error(msg); end if(~isnumeric(nrow) || mod(nrow,1) ~= 0) msg = 'number of rows must be an integer'; error(msg); end if(~isnumeric(ncol) || mod(ncol,1) ~= 0) msg = 'number of columns must be an integer'; error(msg); end if (size(X,1)==1) %transform X as a row in a one column. X=X'; end if (save ~= 0 && save ~=1) msg1 = 'Save must be 1 if you want to save the final figure or 0 if you do NOT want to save final figure'; error(msg1); end if (nrow*ncol