Home > utils > addramp.m

addramp

PURPOSE ^

[wvf] = addramp(x,npts,type);

SYNOPSIS ^

function [wvf] = addramp(x,npts,type)

DESCRIPTION ^

 [wvf] = addramp(x,npts,type);

 type:
  'lin':  linear

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [wvf] = addramp(x,npts,type)
0002 % [wvf] = addramp(x,npts,type);
0003 %
0004 % type:
0005 %  'lin':  linear
0006 
0007 % 03/09/00 PJ
0008 % 02/07/05 PJ -- modified to handle matrices
0009 
0010 msg = nargchk(2,3,nargin);
0011 if msg
0012   error(msg)
0013 end
0014 
0015 if nargin < 3
0016   type = 'lin';
0017 end
0018 
0019 switch type
0020   case {'lin','linear'}
0021     ramp_vals = (0:1/(npts-1):1)';
0022   otherwise
0023     error(sprintf('Unknown ramp type: %s', type))
0024 end
0025 
0026 %x = x(:);
0027 
0028 x(1:npts,:) = x(1:npts,:).*repmat(ramp_vals,1,size(x,2));  % onset ramp
0029 x = flipud(x);
0030 x(1:npts,:) = x(1:npts,:).*repmat(ramp_vals,1,size(x,2));  % offset ramp
0031 wvf = flipud(x);

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003