亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? interp1.m

?? 各種Matlab數學建模工具箱,方程求根,微積分和微分方程等以及一些數學建模競賽的源程序
?? M
字號:
function yi = interp1(varargin)
% yi=interp1(x,y,xi)根據數據(x,y)給出在xi的線性插值結果yi.
% yi=interp1(x,y,xi,'spline')使用三次樣條插值.
% yi=interp1(x,y,xi,'cubic')使用三次插值.
% 例如
%   clear;close;fplot('sin',[0,2*pi]);hold on;
%   x=0:2*pi;y=sin(x);
%   h1=plot(x,y,'ko');
%   xi=[1:5]+0.5;
%   yi=interp1(x,y,xi,'linear');
%   h2=plot(xi,yi,'kx');
%   yi=interp1(x,y,xi,'spline');
%   h3=plot(xi,yi,'k*');
%   legend([h1;h2;h3],'data','linear','spline');
%   hold off;
%
%INTERP1 1-D interpolation (table lookup).
%   YI = INTERP1(X,Y,XI) interpolates to find YI, the values of
%   the underlying function Y at the points in the vector XI.
%   The vector X specifies the points at which the data Y is
%   given. If Y is a matrix, then the interpolation is performed
%   for each column of Y and YI will be length(XI)-by-size(Y,2).
%   Out of range values are returned as NaN. 
%
%   YI = INTERP1(Y,XI) assumes X = 1:N, where N is the length(Y)
%   for vector Y or SIZE(Y,1) for matrix Y.
%
%   Interpolation is the same operation as "table lookup".  Described in
%   "table lookup" terms, the "table" is [X,Y] and INTERP1 "looks-up"
%   the elements of XI in X, and, based upon their location, returns
%   values YI interpolated within the elements of Y.
%
%   YI = INTERP1(X,Y,XI,'method') specifies alternate methods.
%   The default is linear interpolation.  Available methods are:
%
%     'nearest' - nearest neighbor interpolation
%     'linear'  - linear interpolation
%     'spline'  - cubic spline interpolation
%     'cubic'   - cubic interpolation
%
%   All the interpolation methods require that X be monotonic. X can be
%   non-uniformly spaced.  For faster interpolation when X is equally
%   spaced and monotonic, use the methods '*linear', '*cubic', '*nearest'. 
%   For faster linear interpolation when X is non-uniformly spaced 
%   see INTERP1Q.
%
%   For example, generate a coarse sine curve and interpolate over a
%   finer abscissa:
%       x = 0:10; y = sin(x); xi = 0:.25:10;
%       yi = interp1(x,y,xi); plot(x,y,'o',xi,yi)
%
%   See also INTERP1Q, INTERPFT, SPLINE, INTERP2, INTERP3, INTERPN.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 5.25 $  $Date: 1997/11/21 23:40:40 $

error(nargchk(2,4,nargin));

bypass = 0;
uniform = 1;
if isstr(varargin{end}),
  narg = nargin-1;
  method = [varargin{end} '    ']; % Protect against short string.
  if method(1)=='*', % Direct call bypass.
    if method(2)=='l', % linear interpolation.
      yi = linear(varargin{1:end-1});
      return

    elseif method(2)=='c', % cubic interpolation
      yi = cubic(varargin{1:end-1});
      return

    elseif method(2)=='n', % Nearest neighbor interpolation
      yi = nearest(varargin{1:end-1});
      return

    elseif method(2)=='s', % Spline interpolation
      method = 'spline'; bypass = 1;

    else
      error([deblank(method),' is an invalid method.']);

    end
  elseif method(1)=='s', % Spline interpolation
    method = 'spline'; bypass = 1;
  end
  
else
  narg = nargin;
  method = 'linear';
end

if narg==2, % interp1(y,xi)
  y = varargin{1};
  if min(size(y))==1, x = 1:length(y); else x = 1:size(y,1); end
  [msg,x,y,xi] = xychk(x,varargin{1:2});

elseif narg==3, % interp1(x,y,xi)
  [msg,x,y,xi] = xychk(varargin{1:3});

end

if ~isempty(msg), error(msg); end

if isempty(xi), yi = []; return, end
if min(size(xi))~=1, error('XI must be a vector.'); end

x = x(:); % Make sure x is a column vector.
if min(size(y))==1, y = y(:); end % Make sure y is a column vector.
siz = size(xi); xi = xi(:); % Make sure xi is a column vector.

%
% Check for non-equally spaced data.  If so, map x and
% xi to matrix (row,col) coordinate system.
%
if length(x)>2 & ~bypass,
  dx = diff(x);
  if max(abs(diff(dx))) > eps*max(x),
    if any(dx < 0), % Flip orientation of data so x is increasing.
      if size(x,1)==1,
        x = fliplr(x); y = fliplr(y);
        dx = -fliplr(dx);
      else
        x(:) = flipud(x); y(:) = flipud(y);
        dx(:) = -flipud(dx);
      end
    end

    if any(dx<=0), 
      error('X must be monotonic.');
      return
    end

    % Only nearest needs this mapping code now
   if method(1)=='n', 

      % Determine the nearest location of xi in x
      [xxi,j] = sort(xi(:));
      [dum,i] = sort([x;xxi]);
      ui(i) = 1:length(i);
      ui = (ui(length(x)+1:end) - (1:length(xxi)))';
      ui(j) = ui;
    
      % Map values in xi to index offset (ui) via linear interpolation
      ui(ui<1) = 1;
      ui(ui>length(x)-1) = length(x)-1;
      ui = ui + (xi(:)-x(ui))./(x(ui+1)-x(ui));
    
      x = (1:length(x)).';
      xi = ui;
    else
      uniform = 0;
    end
  end
end

%
% Now do the interpolation based on the method flag
%
if method(1)=='n', % Nearest neighbor interpolation
  yi = nearest(x,y,xi);

elseif method(1)=='l', % Linear interpolation
  if uniform
    yi = linear(x,y,xi);
  else
    yi = interp1q(x,y,xi);
  end

elseif method(1)=='s', % Spline interpolation
  yi = spline(x,y.',xi(:).').';

elseif method(1)=='c', % Cubic interpolation
  if uniform
    yi = cubic(x,y,xi);
  else
    d = find(xi < min(x) | xi > max(x));
    yi = spline(x,y.',xi(:).').';
    if min(size(yi))==1, yi(d) = NaN; else yi(d,:) = NaN; end
  end

else
  error([deblank(method),' is an invalid method.']);

end

if (min(size(yi))==1) & (prod(siz)>1), yi = reshape(yi,siz); end


%------------------------------------------------------
function F=linear(x,y,u)
%LINEAR Linear Interpolation of a 1-D function.
%   F=LINEAR(Y,XI) returns the value of the 1-D function Y at the
%   points XI using linear interpolation. length(F)=length(XI). XI is
%   an index into the vector Y. Y is the value of the function
%   evaluated uniformly on a interval. If Y is a matrix, then
%   the interpolation is performed for each column of Y in which
%   case F is length(XI)-by-size(Y,2).
%
%   If Y is of length N then XI must contain values between 1 and N.
%   The value NaN is returned if this is not the case.
%
%   F = LINEAR(X,Y,XI) uses the vector X to specify the coordinates
%   of the underlying interval. X must be equally spaced and
%   monotonic. NaN's are returned for values of XI outside the
%   coordinates in X.
%
%   See also CUBIC, INTERP1.

%   Clay M. Thompson 7-4-91

if nargin==2,   % No X specified.
  u = y; y = x;
  % Check for vector problem.  If so, make everything a column vector.
  if min(size(y))==1, y = y(:); end
  [nrows,ncols] = size(y);

elseif nargin==3, % X specified.
  % Check for vector problem.  If so, make everything a column vector.
  if min(size(y))==1, y = y(:); end
  if min(size(x))==1, x = x(:); end
  [nrows,ncols] = size(y);
  % Scale and shift u to be indices into Y.
  if (min(size(x))~=1), error('X must be a vector.'); end
  [m,n] = size(x);
  if m ~= nrows, 
    error('The length of X must match the number of rows of Y.');
  end
  u = 1 + (u-x(1))/(x(m)-x(1))*(nrows-1);
  
else
  error('Wrong number of input arguments.');
end

if isempty(u), F = []; return, end
if nrows<2, error('Y must have at least 2 rows.'); end

siz = size(u);
u = u(:); % Make sure u is a vector
u = u(:,ones(1,ncols)); % Expand u
[m,n] = size(u);

% Check for out of range values of u and set to 1
uout = find(u<1 | u>nrows);
if ~isempty(uout), u(uout) = 1; end

% Interpolation parameters, check for boundary value.
s = (u - floor(u));
u = floor(u);
if isempty(u), d = u; else d = find(u==nrows); end
if length(d)>0, u(d) = u(d)-1; s(d) = s(d)+1; end

% Now interpolate.
v = (0:n-1)*nrows;
ndx = u+v(ones(m,1),:);
F =  ( y(ndx).*(1-s) + y(ndx+1).*s );

% Now set out of range values to NaN.
if ~isempty(uout), F(uout) = NaN; end

if (min(size(F))==1) & (prod(siz)>1), F = reshape(F,siz); end


%------------------------------------------------------
function F=cubic(x,y,u)
%CUBIC Cubic Interpolation of a 1-D function.
%   YI=CUBIC(Y,XI) returns the value of the 1-D function Y at the
%   points XI using cubic interpolation. length(YI)=length(XI). XI is
%   an index into the vector Y. Y is the value of the function
%   evaluated uniformly on a interval. If Y is a matrix, then
%   the interpolation is performed for each column of Y in which
%   case F is length(XI)-by-size(Y,2).
%
%   If Y is of length N then XI must contain values between 1 and N.
%   The value NaN is returned if this is not the case.
%
%   YI = CUBIC(X,Y,XI) uses the vector X to specify the coordinates
%   of the underlying interval. X must be equally spaced and
%   monotonic. NaN's are returned for values of XI outside the
%   coordinates in X.
%
%   See also LINEAR, INTERP1.

%   Clay M. Thompson 7-4-91

%   Based on "Cubic Convolution Interpolation for Digital Image
%   Processing", Robert G. Keys, IEEE Trans. on Acoustics, Speech, and
%   Signal Processing, Vol. 29, No. 6, Dec. 1981, pp. 1153-1160.

if nargin==2,   % No X specified.
  u = y; y = x;
  % Check for vector problem.  If so, make everything a column vector.
  if min(size(y))==1, y = y(:); end
  [nrows,ncols] = size(y);

elseif nargin==3, % X specified.
  % Check for vector problem.  If so, make everything a column vector.
  if min(size(y))==1, y = y(:); end
  if min(size(x))==1, x = x(:); end
  [nrows,ncols] = size(y);
  % Scale and shift u to be indices into Y.
  if (min(size(x))~=1), error('X must be a vector.'); end
  [m,n] = size(x);
  if m ~= nrows, 
    error('The length of X must match the number of rows of Y.');
  end
  u = 1 + (u-x(1))/(x(m)-x(1))*(nrows-1);
  
else
  error('Wrong number of input arguments.');
end

if isempty(u), F = []; return, end
if nrows<3, error('Y must have at least 3 rows.'); end

siz = size(u); u = u(:); % Make sure u is a vector.
u = u(:,ones(1,ncols)); % Expand u 
[m,n] = size(u);

% Check for out of range values of u and set to 1
if isempty(u), uout = u; else uout = find(u<1 | u>nrows); end
if ~isempty(uout), u(uout) = 1; end

% Interpolation parameters, check for boundary value.
s = (u - floor(u));
u = floor(u);
if isempty(u), d = u; else d = find(u==nrows); end
if length(d)>0, u(d) = u(d)-1; s(d) = s(d)+1; end

% Expand y so interpolation is valid at the boundary.
y = [3*y(1,:)-3*y(2,:)+y(3,:);y;3*y(nrows,:)-3*y(nrows-1,:)+y(nrows-2,:)];
nrows = nrows + 2;

% Now interpolate using computationally efficient algorithm.
s2 = s.*s; s3 = s.*s2;
v = (0:n-1)*nrows;
ndx = u+v(ones(m,1),:);
F = y(ndx).*(-s3+2*s2-s) + y(ndx+1).*(3*s3-5*s2+2) + ...
    y(ndx+2).*(-3*s3+4*s2+s) + y(ndx+3).*(s3-s2);
F = F/2;

% Now set out of range values to NaN.
if ~isempty(uout), F(uout) = NaN; end

if (min(size(F))==1) & (prod(siz)>1), F = reshape(F,siz); end


%------------------------------------------------------
function F = nearest(x,y,u)
%NEAREST Nearest Neighbor Interpolation of a 1-D function.
%   YI=NEAREST(Y,XI) returns the value of the 1-D function Y at
%   the points XI using nearest neighbor interpolation,
%   length(YI)=length(XI). XI is an index into the vector Y. Y is
%   the value of the function evaluated uniformly on a interval. If
%   Y is a matrix, then the interpolation is performed for each
%   column of Y in which case F is length(XI)-by-size(Y,2).
%
%   If Y is of length N then XI must contain values between 1 and N.
%   The value NaN is returned if this is not the case.
%
%   YI = NEAREST(X,Y,XI) uses the vector X to specify the
%   coordinates of the underlying interval. X must be equally spaced
%   and monotonic. NaN's are returned for values of XI outside the
%   coordinates in X.
%
%   See also LINEAR, INTERP1.

%   Clay M. Thompson 7-4-91

if nargin==2,   % No X specified.
  u = y; y = x;
  % Check for vector problem.  If so, make everything a column vector.
  if min(size(y))==1, y = y(:); end
  [nrows,ncols] = size(y);

elseif nargin==3, % X specified.
  % Check for vector problem.  If so, make everything a column vector.
  if min(size(y))==1, y = y(:); end
  if min(size(x))==1, x = x(:); end
  [nrows,ncols] = size(y);
  % Scale and shift u to be indices into Y.
  if (min(size(x))~=1), error('X must be a vector.'); end
  [m,n] = size(x);
  if m ~= nrows, 
    error('The length of X must match the number of rows of Y.');
  end
  u = 1 + (u-x(1))/(x(m)-x(1))*(nrows-1);
  
else
  error('Wrong number of input arguments.');
end

if isempty(u), F = []; return, end
if nrows<2, error('Y must have at least 2 rows.'); end

siz = size(u); u = u(:); % Make sure u is a vector.
u = u(:,ones(1,ncols)); % Expand u 
[m,n] = size(u);

% Check for out of range values of u and set to 1
uout = find(u<.5 | u>=nrows+.5);
if ~isempty(uout), u(uout) = 1; end

% Interpolation parameters
s = (u - round(u));
u = round(u);

% Now interpolate
v = (0:n-1)*nrows;
ndx = u+v(ones(m,1),:);
F = y(ndx);

% Now set out of range values to NaN.
if ~isempty(uout), F(uout) = NaN; end

if (min(size(F))==1) & (prod(siz)>1), F = reshape(F,siz); end

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产百合女同互慰| 一区二区三区欧美| 悠悠色在线精品| 激情文学综合丁香| 7777精品久久久大香线蕉| 国产精品久久久久久妇女6080| 日本一道高清亚洲日美韩| 色综合色综合色综合| 久久久久久久久久美女| 日韩二区在线观看| 欧美艳星brazzers| 亚洲伦在线观看| 成人免费电影视频| 久久夜色精品国产噜噜av | 国产乱淫av一区二区三区| 精品污污网站免费看| 亚洲啪啪综合av一区二区三区| 国产一区视频网站| 欧美成人性福生活免费看| 亚洲bt欧美bt精品| 欧美日韩免费观看一区二区三区| 亚洲人精品午夜| 成人做爰69片免费看网站| 国产无一区二区| 国产麻豆精品95视频| 精品国精品自拍自在线| 精品无人码麻豆乱码1区2区 | 欧美军同video69gay| 一区二区三区在线观看欧美| 91蜜桃免费观看视频| 亚洲天堂久久久久久久| 91亚洲男人天堂| 亚洲老妇xxxxxx| 欧美日韩一区二区三区在线看 | 欧美精品色一区二区三区| 亚洲成人一区在线| 在线综合视频播放| 国模娜娜一区二区三区| 欧美激情在线一区二区| 97久久精品人人爽人人爽蜜臀| 亚洲婷婷综合久久一本伊一区 | 337p日本欧洲亚洲大胆精品| 激情国产一区二区| 亚洲国产精品精华液2区45| 成人短视频下载| 亚洲欧美福利一区二区| 7777精品伊人久久久大香线蕉最新版| 午夜私人影院久久久久| 欧美本精品男人aⅴ天堂| 国产成人亚洲综合色影视| 国产精品人成在线观看免费| 色婷婷久久综合| 蜜桃一区二区三区在线观看| 国产丝袜美腿一区二区三区| 色综合久久久久久久久久久| 亚洲bt欧美bt精品| 国产三级精品三级| 欧美色区777第一页| 经典三级视频一区| 国产精品久久久久影院亚瑟 | 美腿丝袜亚洲综合| 国产精品乱码一区二区三区软件| 色噜噜夜夜夜综合网| 免费人成网站在线观看欧美高清| 久久久精品一品道一区| 欧洲视频一区二区| 国产乱子伦视频一区二区三区| 伊人色综合久久天天人手人婷| 欧美一区二区在线免费播放| 成人v精品蜜桃久久一区| 亚洲成人福利片| 国产精品美女久久久久久久久久久| 欧美日韩一区二区三区视频| 国产一区二区三区综合| 亚洲国产裸拍裸体视频在线观看乱了| 欧美电视剧在线观看完整版| 91精彩视频在线观看| 国产一区二区中文字幕| 亚洲成av人片一区二区梦乃 | 一本久久a久久免费精品不卡| 日本一不卡视频| 亚洲综合网站在线观看| 国产欧美一区二区三区沐欲| 欧美一级一级性生活免费录像| a4yy欧美一区二区三区| 国内精品国产成人| 亚洲第一电影网| 国产精品三级久久久久三级| 欧美tickle裸体挠脚心vk| 欧美色综合影院| 91免费精品国自产拍在线不卡 | 中文字幕亚洲在| 久久精品在线免费观看| 日韩欧美视频一区| 在线不卡中文字幕| 欧美性一级生活| 色婷婷激情久久| 一本久久a久久免费精品不卡| 成人h动漫精品一区二| 国产成人精品一区二| 国内精品在线播放| 九九久久精品视频| 美女一区二区视频| 男人操女人的视频在线观看欧美| 一区二区三区四区在线| 亚洲欧洲99久久| 18欧美亚洲精品| 亚洲四区在线观看| 亚洲女人的天堂| 亚洲综合在线观看视频| 亚洲免费观看在线观看| 伊人性伊人情综合网| 一区二区三区色| 亚洲第一在线综合网站| 日韩影院免费视频| 免费欧美高清视频| 经典三级一区二区| 国产高清久久久| 成人性生交大片免费| 91无套直看片红桃| 在线看日本不卡| 欧美日韩久久久一区| 欧美一区二区三区免费观看视频| 欧美一区二区视频在线观看2022| 欧美一区午夜精品| 久久先锋影音av鲁色资源网| 久久久久久9999| 亚洲人成人一区二区在线观看| 亚洲午夜在线观看视频在线| 日本视频中文字幕一区二区三区| 免费亚洲电影在线| 国产精品一区二区久久不卡| gogogo免费视频观看亚洲一| 欧美吻胸吃奶大尺度电影| 欧美一区二区观看视频| 精品久久久久一区二区国产| 国产精品色眯眯| 亚洲成av人**亚洲成av**| 久久成人免费网| www.日韩在线| 在线不卡a资源高清| 2021久久国产精品不只是精品| 国产精品素人一区二区| 亚洲一区二区在线免费观看视频| 另类人妖一区二区av| 99精品桃花视频在线观看| 欧美卡1卡2卡| 国产精品免费视频网站| 日韩和欧美的一区| 波多野结衣亚洲| 日韩一级黄色大片| 亚洲色图视频网| 久久99精品久久久久久| 色94色欧美sute亚洲线路一ni| 精品国产成人系列| 亚洲国产精品久久人人爱 | 国产精品的网站| 日本最新不卡在线| 99久久精品免费精品国产| 91精品国产色综合久久ai换脸| 国产精品污污网站在线观看| 亚洲18女电影在线观看| 成人久久久精品乱码一区二区三区| 欧美精品亚洲一区二区在线播放| 亚洲国产精品高清| 久久精品国产精品青草| 精品视频资源站| 亚洲免费色视频| fc2成人免费人成在线观看播放 | 国产激情偷乱视频一区二区三区 | 免费视频一区二区| 在线观看不卡一区| 国产精品高潮呻吟| 国产一区欧美二区| 日韩你懂的在线播放| 午夜视频在线观看一区| 色婷婷亚洲精品| 亚洲免费在线看| 99久久精品国产毛片| 中文字幕欧美三区| 丁香桃色午夜亚洲一区二区三区| 日韩精品在线网站| 男人操女人的视频在线观看欧美| 欧美在线观看视频一区二区三区| 国产精品第四页| 播五月开心婷婷综合| www一区二区| 国内久久精品视频| 26uuu另类欧美| 精品一区二区日韩| 精品欧美黑人一区二区三区| 日本美女一区二区三区视频| 欧美日韩国产一二三| 亚洲狠狠爱一区二区三区| 在线一区二区视频| 亚洲国产视频一区二区| 欧美在线一区二区三区| 天堂资源在线中文精品| 6080午夜不卡| 日韩va亚洲va欧美va久久|