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

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

?? interp2.m

?? matlab建模工具箱及其應用 功能強大 收藏了很久了 和大家一起分享
?? M
?? 第 1 頁 / 共 2 頁
字號:
function zi = interp2(varargin)
%二元函數網格數據的插值
%ZI=interp2(X,Y,Z,XI,YI,'方法')  求二元函數z=f(x,y)的插值. 
%   這里X,Y,Z是同維數矩陣表示網格數據,XI,YI,ZI是同維數矩陣表示插值點.
%或ZI=interp2(x,y,z,xi,yi)其中,x,xi為行向量,y,yi為列向量.
%  'bilinear',使用雙線性插值(默認)
%  'spline' 使用二元三次樣條插值.
%  'cubic' 使用二元三次插值.
%例如
%   clear;close;x=0:4;y=2:4;
%   Z=[82 81 80 82 84;79 63 61 65 81;84 84 82 85 86];
%   [X,Y]=meshgrid(x,y);
%   subplot(2,1,1);
%   mesh(X,Y,Z);title('RAW DATA');
%   xi=0:0.1:4;yi=2:0.2:4;
%   [XI,YI]=meshgrid(xi,yi);
%   zspline=interp2(x,y,z,XI,YI,'spline');
%   subplot(2,1,2);
%   mesh(XI,YI,zspline);
%   title('SPLINE');
%
%INTERP2 2-D interpolation (table lookup).
%   ZI = INTERP2(X,Y,Z,XI,YI) interpolates to find ZI, the values of the
%   underlying 2-D function Z at the points in matrices XI and YI.
%   Matrices X and Y specify the points at which the data Z is given.
%   Out of range values are returned as NaN.
%
%   XI can be a row vector, in which case it specifies a matrix with
%   constant columns. Similarly, YI can be a column vector and it 
%   specifies a matrix with constant rows. 
%
%   ZI = INTERP2(Z,XI,YI) assumes X=1:N and Y=1:M where [M,N]=SIZE(Z).
%   ZI = INTERP2(Z,NTIMES) expands Z by interleaving interpolates between
%   every element, working recursively for NTIMES.  INTERP2(Z) is the
%   same as INTERP2(Z,1).
%
%   ZI = INTERP2(...,'method') specifies alternate methods.  The default
%   is linear interpolation.  Available methods are:
%
%     'nearest' - nearest neighbor interpolation
%     'linear'  - bilinear interpolation
%     'cubic'   - bicubic interpolation
%     'spline'  - spline interpolation
%
%   All the interpolation methods require that X and Y be monotonic and
%   plaid (as if they were created using MESHGRID).  X and Y can be
%   non-uniformly spaced.  For faster interpolation when X and Y are
%   equally spaced and monotonic, use the methods '*linear', '*cubic', or
%   '*nearest'.
%
%   For example, to generate a coarse approximation of PEAKS and
%   interpolate over a finer mesh:
%       [x,y,z] = peaks(10); [xi,yi] = meshgrid(-3:.1:3,-3:.1:3);
%       zi = interp2(x,y,z,xi,yi); mesh(xi,yi,zi)
%      
%   See also INTERP1, INTERP3, INTERPN, MESHGRID, GRIDDATA.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 5.26 $

error(nargchk(1,6,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' | all(method(2:4)=='bil'), % bilinear interpolation.
      zi = linear(varargin{1:end-1});
      return

    elseif method(2)=='c' | all(method(2:4)=='bic'), % bicubic interpolation
      zi = cubic(varargin{1:end-1});
      return

    elseif method(2)=='n', % Nearest neighbor interpolation
      zi = 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==1, % interp2(z), % Expand Z
  [nrows,ncols] = size(varargin{1});
  xi = 1:.5:ncols; yi = (1:.5:nrows)';
  x = 1:ncols; y = (1:nrows);
  [msg,x,y,z,xi,yi] = xyzchk(x,y,varargin{1},xi,yi);

elseif narg==2. % interp2(z,n), Expand Z n times
  [nrows,ncols] = size(varargin{1});
  ntimes = floor(varargin{2}(1));
  xi = 1:1/(2^ntimes):ncols; yi = (1:1/(2^ntimes):nrows)';
  x = 1:ncols; y = (1:nrows);
  [msg,x,y,z,xi,yi] = xyzchk(x,y,varargin{1},xi,yi);

elseif narg==3, % interp2(z,xi,yi)
  [nrows,ncols] = size(varargin{1});
  x = 1:ncols; y = (1:nrows);
  [msg,x,y,z,xi,yi] = xyzchk(x,y,varargin{1:3});

elseif narg==4,
  error('Wrong number of input arguments.');

elseif narg==5, % linear(x,y,z,xi,yi)
  [msg,x,y,z,xi,yi] = xyzchk(varargin{1:5});

end

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

%
% Check for plaid data.
%
xx = x(1,:); yy = y(:,1);
if (size(x,2)>1 & ~isequal(repmat(xx,size(x,1),1),x)) | ...
   (size(y,1)>1 & ~isequal(repmat(yy,1,size(y,2)),y)),
  error(sprintf(['X and Y must be matrices produced by MESHGRID. Use' ...
     ' GRIDDATA instead \nof INTERP2 for scattered data.']));
end

%
% Check for non-equally spaced data.  If so, map (x,y) and
% (xi,yi) to matrix (row,col) coordinate system.
%
if ~bypass,
  xx = xx.'; % Make sure it's a column.
  dx = diff(xx); dy = diff(yy);
  xdiff = max(abs(diff(dx))); if isempty(xdiff), xdiff = 0; end
  ydiff = max(abs(diff(dy))); if isempty(ydiff), ydiff = 0; end
  if (xdiff > eps*max(abs(xx))) | (ydiff > eps*max(abs(yy))),
    if any(dx < 0), % Flip orientation of data so x is increasing.
      x = fliplr(x); y = fliplr(y); z = fliplr(z);
      xx = flipud(xx); dx = -flipud(dx);
    end
    if any(dy < 0), % Flip orientation of data so y is increasing.
      x = flipud(x); y = flipud(y); z = flipud(z);
      yy = flipud(yy); dy = -flipud(dy);
    end
  
    if any(dx<=0) | any(dy<=0), 
      error('X and Y must be monotonic vectors or matrices produced by MESHGRID.');
    end
  
    % Bypass mapping code for cubic
    if method(1)~='c', 
      % Determine the nearest location of xi in x
      [xxi,j] = sort(xi(:));
      [dum,i] = sort([xx;xxi]);
      ui(i) = (1:length(i));
      ui = (ui(length(xx)+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(xx)-1) = length(xx)-1;
      ui = ui + (xi(:)-xx(ui))./(xx(ui+1)-xx(ui));
     
      % Determine the nearest location of yi in y
      [yyi,j] = sort(yi(:));
      [dum,i] = sort([yy;yyi(:)]);
      vi(i) = (1:length(i));
      vi = (vi(length(yy)+1:end)-(1:length(yyi)))';
      vi(j) = vi;
    
      % Map values in yi to index offset (vi) via linear interpolation
      vi(vi<1) = 1;
      vi(vi>length(yy)-1) = length(yy)-1;
      vi = vi + (yi(:)-yy(vi))./(yy(vi+1)-yy(vi));
      
      [x,y] = meshgrid(1:size(x,2),1:size(y,1));
      xi(:) = ui; yi(:) = vi;
    else
      uniform = 0;
    end
  end
end

% Now do the interpolation based on method.
method = [lower(method),'   ']; % Protect against short string

if method(1)=='l' | all(method(1:3)=='bil'), % bilinear interpolation.
  zi = linear(x,y,z,xi,yi);

elseif method(1)=='c' | all(method(1:3)=='bic'), % bicubic interpolation
  if uniform
    zi = cubic(x,y,z,xi,yi);
  else
    d = find(xi < min(x(:)) | xi > max(x(:)) | ...
             yi < min(y(:)) | yi > max(y(:)));
    zi = spline2(x,y,z,xi,yi);
    zi(d) = NaN;
  end

elseif method(1)=='n', % Nearest neighbor interpolation
  zi = nearest(x,y,z,xi,yi);

elseif method(1)=='s', % Spline interpolation
  zi = spline2(x,y,z,xi,yi);

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

end

%------------------------------------------------------
function F = linear(arg1,arg2,arg3,arg4,arg5)
%LINEAR 2-D bilinear data interpolation.
%   ZI = LINEAR(X,Y,Z,XI,YI) uses bilinear interpolation to
%   find ZI, the values of the underlying 2-D function in Z at the points
%   in matrices XI and YI.  Matrices X and Y specify the points at which 
%   the data Z is given.  X and Y can also be vectors specifying the 
%   abscissae for the matrix Z as for MESHGRID. In both cases, X
%   and Y must be equally spaced and monotonic.
%
%   Values of NaN are returned in ZI for values of XI and YI that are 
%   outside of the range of X and Y.
%
%   If XI and YI are vectors, LINEAR returns vector ZI containing
%   the interpolated values at the corresponding points (XI,YI).
%
%   ZI = LINEAR(Z,XI,YI) assumes X = 1:N and Y = 1:M, where
%   [M,N] = SIZE(Z).
%
%   ZI = LINEAR(Z,NTIMES) returns the matrix Z expanded by interleaving
%   bilinear interpolates between every element, working recursively
%   for NTIMES.  LINEAR(Z) is the same as LINEAR(Z,1).
%
%   This function needs about 4 times SIZE(XI) memory to be available.
%
%   See also INTERP2, CUBIC.

%   Clay M. Thompson 4-26-91, revised 7-3-91, 3-22-93 by CMT.

if nargin==1, % linear(z), Expand Z
  [nrows,ncols] = size(arg1);
  s = 1:.5:ncols; sizs = size(s);
  t = (1:.5:nrows)'; sizt = size(t);
  s = s(ones(sizt),:);
  t = t(:,ones(sizs));

elseif nargin==2, % linear(z,n), Expand Z n times
  [nrows,ncols] = size(arg1);
  ntimes = floor(arg2);
  s = 1:1/(2^ntimes):ncols; sizs = size(s);
  t = (1:1/(2^ntimes):nrows)'; sizt = size(t);
  s = s(ones(sizt),:);
  t = t(:,ones(sizs));

elseif nargin==3, % linear(z,s,t), No X or Y specified.
  [nrows,ncols] = size(arg1);
  s = arg2; t = arg3;

elseif nargin==4,
  error('Wrong number of input arguments.');

elseif nargin==5, % linear(x,y,z,s,t), X and Y specified.
  [nrows,ncols] = size(arg3);
  mx = prod(size(arg1)); my = prod(size(arg2));
  if any([mx my] ~= [ncols nrows]) & ...
     ~isequal(size(arg1),size(arg2),size(arg3))
    error('The lengths of the X and Y vectors must match Z.');
  end
  if any([nrows ncols]<[2 2]), error('Z must be at least 2-by-2.'); end
  s = 1 + (arg4-arg1(1))/(arg1(mx)-arg1(1))*(ncols-1);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线影视一区二区三区| 日韩视频在线观看一区二区| 欧美图区在线视频| 精品乱人伦一区二区三区| 国产精品美女一区二区| 婷婷久久综合九色综合绿巨人| 久久电影网电视剧免费观看| 色狠狠色狠狠综合| 国产婷婷色一区二区三区| 亚洲国产美女搞黄色| 成人国产精品免费观看视频| 日韩视频一区在线观看| 亚洲一区免费观看| 色综合天天综合| 久久精品一区八戒影视| 日本视频中文字幕一区二区三区| 色先锋资源久久综合| 中日韩免费视频中文字幕| 黄色日韩三级电影| 91精品国产欧美一区二区18| 亚洲一区二区三区四区中文字幕| 北条麻妃一区二区三区| 国产精品三级在线观看| 国产精品中文字幕一区二区三区| 日韩无一区二区| 丝袜美腿亚洲一区| 欧美日韩一区二区三区不卡 | 亚洲视频免费看| 国产成人免费xxxxxxxx| 久久麻豆一区二区| 韩国v欧美v日本v亚洲v| 久久久久久一二三区| 久久99精品一区二区三区| 精品国产网站在线观看| 精一区二区三区| 久久久精品免费观看| 国产成人av影院| 国产精品卡一卡二卡三| 一本色道**综合亚洲精品蜜桃冫| 亚洲美女屁股眼交3| 欧美日韩一区二区三区视频 | 在线免费观看成人短视频| 一区二区三区四区激情| 欧美网站大全在线观看| 免费在线成人网| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 91麻豆精品国产91久久久久久久久| 亚洲风情在线资源站| 91麻豆精品国产无毒不卡在线观看 | 国产一区二区网址| 国产日韩高清在线| eeuss国产一区二区三区| 一区二区在线观看不卡| 欧美日韩免费不卡视频一区二区三区| 香蕉久久夜色精品国产使用方法 | 91一区二区在线观看| 亚洲精品国产成人久久av盗摄| 欧洲一区二区三区免费视频| 青青青伊人色综合久久| 欧美高清在线一区二区| 精品视频在线免费观看| 日韩电影免费在线看| 国产女人aaa级久久久级 | 亚洲伦在线观看| 欧美久久一区二区| 国产麻豆成人传媒免费观看| 亚洲色图.com| 日韩一区二区电影在线| youjizz国产精品| 日韩和欧美一区二区三区| 日本一区免费视频| 欧美日韩综合在线| 国产sm精品调教视频网站| 亚洲午夜av在线| 中文字幕av一区二区三区高| 欧美日韩精品福利| 国产99一区视频免费| 亚洲第一av色| 国产精品不卡在线| 欧美成人猛片aaaaaaa| 91极品美女在线| 国产高清一区日本| 午夜精品aaa| 136国产福利精品导航| 日韩欧美国产一区二区三区| 91激情在线视频| 成人免费不卡视频| 国产真实乱子伦精品视频| 亚洲成av人片在线| 亚洲品质自拍视频网站| 久久精品视频在线看| 欧美日韩久久久久久| k8久久久一区二区三区| 国产一区二区三区美女| 日韩 欧美一区二区三区| 蜜桃av一区二区在线观看| 亚洲精品日韩综合观看成人91| 国产欧美一区二区三区沐欲| 欧美一级xxx| 欧美日韩国产影片| 在线看一区二区| av中文字幕在线不卡| 国产成人8x视频一区二区| 极品少妇一区二区| 美女一区二区视频| 水蜜桃久久夜色精品一区的特点 | 久久久久久久久久久久电影| 欧美一级久久久| 91精品麻豆日日躁夜夜躁| 欧美日韩亚洲综合一区| 日本国产一区二区| 在线观看国产精品网站| 欧美亚洲综合另类| 欧洲一区在线观看| 欧美理论电影在线| 欧美一级专区免费大片| 91精品福利在线一区二区三区 | 国产精品麻豆一区二区| 国产婷婷色一区二区三区在线| 久久久午夜精品理论片中文字幕| 精品成人免费观看| 久久综合九色综合久久久精品综合| 日韩欧美的一区二区| 久久在线免费观看| 日本一区二区综合亚洲| 亚洲婷婷在线视频| 亚洲国产一区视频| 麻豆成人在线观看| 国产一区二区不卡| eeuss鲁片一区二区三区| 91一区在线观看| 欧美日韩成人在线| 一区二区久久久久久| 亚洲成人免费看| 免费高清在线一区| 国产精品一区二区男女羞羞无遮挡 | 在线观看网站黄不卡| 欧美日韩国产一级片| 日韩免费高清视频| 国产精品情趣视频| 亚洲宅男天堂在线观看无病毒| 丝袜国产日韩另类美女| 韩国av一区二区| 99精品视频一区| 91精品欧美一区二区三区综合在| 久久这里只有精品视频网| 日韩理论在线观看| 日韩精品一级中文字幕精品视频免费观看 | 国产精品亚洲视频| 一本大道久久a久久精品综合| 欧美一三区三区四区免费在线看 | 亚洲九九爱视频| 欧美aa在线视频| av电影在线观看不卡 | 91免费视频观看| 欧美一区二区播放| 中文字幕第一区第二区| 日韩在线一二三区| 成人黄色国产精品网站大全在线免费观看| 色婷婷综合视频在线观看| 精品久久五月天| 亚洲国产精品人人做人人爽| 国产一二精品视频| 欧美日韩1234| 国产精品国产精品国产专区不蜜 | 成人激情综合网站| 欧美一区二区精品久久911| 亚洲图片激情小说| 国产一区二区不卡在线| 欧美日韩国产精选| 亚洲男人的天堂在线观看| 韩国女主播一区| 91精品一区二区三区久久久久久| 自拍偷拍国产亚洲| 国产成人在线电影| 精品伦理精品一区| 日本不卡123| 欧美日韩一本到| 亚洲在线观看免费视频| 成人一区二区三区中文字幕| 精品国产乱码久久久久久1区2区| 视频一区国产视频| 欧美自拍偷拍一区| 亚洲日本在线看| av日韩在线网站| 中文字幕乱码一区二区免费| 国产一区二区三区av电影| 日韩欧美国产麻豆| 日本免费在线视频不卡一不卡二| 欧美视频第二页| 亚洲一级二级三级| 欧美色窝79yyyycom| 一区二区三区欧美日| 色婷婷久久久综合中文字幕| 自拍av一区二区三区| 久久综合色8888| 国产一区二区在线视频| 亚洲精品一区二区在线观看| 激情五月婷婷综合网| 精品欧美一区二区久久|