respace.m

来自「一些制作正交曲线网格的matlab源程序」· M 代码 · 共 38 行

M
38
字号
function theResult = respace(x, x1, x2)% respace -- Re-space values linearly.%  respace(x, x1, x2) respaces the values of vector x,%   such that the original x1 is moved to x2 and all%   the others are correspondingly moved linearly%   between the end-points. % Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.%  All Rights Reserved.%   Disclosure without explicit written consent from the%    copyright owner does not constitute publication. % Version of 23-Apr-1999 13:21:29.% Updated    25-Aug-1999 07:16:00.if nargin < 3, help(mfilename), return, endxmin = min(x(:)); x = x - xmin;xmax = max(x(:)); x = x ./ xmax;x1 = (x1 - xmin); x1 = x1 ./ xmax;x2 = (x2 - xmin); x2 = x2 ./ xmax;i = find(x <= x1);j = find(x > x1);x(i) = x(i) .* x2 ./ x1;x(j) = 1 - (1 - x(j)) .* (1 - x2) ./ (1 - x1);result = x .* xmax + xmin;if nargout > 0	theResult = result;else	disp(result)end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?