沈雯的回答:PAPR是峰均比,PAR没什么区别吧 飞鸟和鱼的回答:data=circshift(data,[4 0]); function b = circshift(a,p) %circshift shift array circularly. % b = circshift(a,shiftsize) circularly shifts the values in the array a % by shiftsize elements. shiftsize is a vector of integer scalars where % the n-th element specifies the shift amount for the n-th dimension of % array a. if an element in shiftsize is positive, the values of a are % shifted down (or to the right). if it is negative, the values of a % are shifted up (or to the left). % % examples: % a = [ 1 2 3;4 5 6; 7 8 9]; % b = circshift(a,1) % circularly shifts first dimension values down by 1. % b = 7 8 9 % 1 2 3 % 4 5 6 % b = circshift(a,[1 -1]) % circularly shifts first dimension values % % down by 1 and second dimension left by 1. % b = 8 9 7 % 2 3 1 % 5 6 4 % % see also fftshift, shiftdim, permute. % copyright 1984-2004 the mathworks, inc. % $revision: 1.11.4.2 $ $date: 2004/12/06 16:34:07 $ %稀疏矩阵的特性分析 % error out if there are not exactly two input arguments if nargin < 2 %nargin 代表函数变量的数目 error('matlab:circshift:noinputs',['no input arguments specified. ' ... 'there should be exactly two input arguments.']) end % parse the inputs to reveal the variables necessary for the calculations %%判断输入条件 [p, sizea, numdimsa, msg] = parseinputs(a,p); % error out if parseinputs discovers an improper shiftsize input if (~isempty(msg)) %isempty 测试数组是否为空 为空返回值1,否返回值0 error('matlab:circshift:invalidshifttype','%s',msg); end % calculate the indices that will convert the input matrix to the desired output % initialize the cell array of indices idx = cell(1, numdimsa);%cell 创建空矩阵的单元数据 % loop through each dimension of the input matrix to calculate shifted indices for k = 1:numdimsa m = sizea(k); idx{k} = mod((0:m-1)-p(k), m)+1; end % perform the actual conversion by indexing into the input matrix b = a(idx{:}); %%% %%% parse inputs %%% function [p, sizea, numdimsa, msg] = parseinputs(a,p) % default values sizea = size(a); numdimsa = ndims(a);%ndims 取数组的维数 msg = ''; % make sure that shiftsize input is a finite, real integer vector sh = p(:); isfinite = all(isfinite(sh));%isfinite 检测数组元素的有限元素,返回一个与a维相同的数组,相对应的,有限值为1,无限或nun为0 %all测试是否所有元素都为非零元素,是,1;否0.以列检测。 nonsparse = all(~issparse(sh));%issparse(a) 检测矩阵是否为稀疏矩阵 a为稀疏矩阵返回逻辑值1,反之则反 isinteger = all(isa(sh,'double') & (imag(sh)==0) & (sh==round(sh)));%isa 检测sh对象的类,imag 取复数的虚部,round 去最近的整数 isvector = ((ndims(p) == 2) && ((size(p,1) == 1) || (size(p,2) == 1))); if ~(isfinite && isinteger && isvector && nonsparse) msg = ['invalid shift type: ' ... 'must be a finite, nonsparse, real integer vector.']; return; end % make sure the shift vector has the same length as numdimsa. % the missing shift values are assumed to be 0. the extra % shift values are ignored when the shift vector is longer % than numdimsa. if (numel(p) < numdimsa) %numel(a)返回数组a中元素的个数 p(numdimsa) = 0; end |