📄 offset.m
字号:
function[varargout]=offset(varargin)%OFFSET Offsets matrix rows or columns%% MATOUT = OFFSET(MATIN,SHIFT,DIM), where SHIFT is a scalar, offsets% dimension DIM of MATIN by SHIFT. % % Use OFFSET to produce 'waterfall' plots of data. ex: % [x,y,z]=peaks; plot(offset(z,2,2)) %% OFFSET(MATIN,SHIFT,DIM) where MATIN is a named matrix% overwrites it with MATIN.%% See also YOFFSET, XOFFSET % _________________________________________________________________% This is part of JLAB --- type 'help jlab' for more information% (C) 2001, 2004 J.M. Lilly --- type 'help jlab_license' for details % JML Make this work for N-Ddim=varargin{end};offset=varargin{end-1};for i=1:length(varargin)-2 varargout{i}=offset1(varargin{i},offset,dim);endeval(to_overwrite(nargin-2)) function[y]=offset1(x,offset,dim)N=size(x,dim);if isscalar(offset) offset=offset*[0:N-1];endif N~=length(offset) error('Length of offset vector must equal SIZE(X,DIM)')end%Reverse dim for calling VADDif dim==2 dim=1;elseif dim==1 dim=2;end%make sure they are oriented the right wayif dim==1 offset=conj(offset(:)');elseif dim==2 offset=offset(:);endy=vadd(x,offset,dim);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -