亚洲欧美第一页_禁久久精品乱码_粉嫩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精品午夜视频| 国产一区二区精品久久99| 韩国三级中文字幕hd久久精品| 免费观看成人av| 国产精品影视天天线| 丁香亚洲综合激情啪啪综合| 色婷婷av一区二区| 91麻豆精品国产自产在线观看一区| 日韩欧美二区三区| 亚洲欧美区自拍先锋| 久久机这里只有精品| 处破女av一区二区| 欧美在线观看视频一区二区三区| 欧美不卡激情三级在线观看| 国产三区在线成人av| 一区二区久久久| 九色综合狠狠综合久久| 91福利资源站| 国产午夜精品福利| 麻豆成人久久精品二区三区小说| 成人高清视频免费观看| 51精品视频一区二区三区| 国产精品久久久久久久蜜臀| 蜜臂av日日欢夜夜爽一区| 欧美专区日韩专区| 中文在线免费一区三区高中清不卡| 亚洲国产精品一区二区久久| aaa亚洲精品| 国产精品视频一二三区| 国产高清一区日本| 精品粉嫩aⅴ一区二区三区四区| 亚洲成av人片在线| 欧美一区午夜精品| 日韩av不卡在线观看| 日韩一区二区三区视频| 亚洲成人综合视频| 欧美三级一区二区| 日本不卡一区二区三区高清视频| 欧美影院一区二区| 视频一区国产视频| 精品日韩成人av| 成人sese在线| 亚洲精品老司机| 777午夜精品免费视频| 免费看日韩a级影片| 国产亚洲人成网站| 91在线视频播放地址| 亚洲蜜臀av乱码久久精品| 欧美亚洲另类激情小说| 男女性色大片免费观看一区二区| 日韩精品一区二区三区swag| 国产成人啪免费观看软件| 亚洲欧美一区二区三区极速播放 | 欧美唯美清纯偷拍| 日韩成人av影视| 亚洲特级片在线| 678五月天丁香亚洲综合网| 国产精品资源网| 亚洲国产精品综合小说图片区| 日韩欧美自拍偷拍| 色哟哟一区二区在线观看| 久久不见久久见免费视频1| 国产精品蜜臀av| 日韩一级免费一区| 在线观看av不卡| av毛片久久久久**hd| 麻豆精品一区二区综合av| 亚洲日本免费电影| 久久久精品国产99久久精品芒果| 欧美日韩第一区日日骚| 97精品视频在线观看自产线路二| 五月激情六月综合| 亚洲综合另类小说| 国产日产欧美一区| 中文字幕va一区二区三区| 欧美日本乱大交xxxxx| 91麻豆精品在线观看| 91在线观看视频| 一本色道**综合亚洲精品蜜桃冫 | 欧美精品久久久久久久久老牛影院| 丁香另类激情小说| av一区二区三区在线| 99久久免费国产| 91九色02白丝porn| 欧美日韩精品系列| 91精品国产色综合久久久蜜香臀| 在线国产亚洲欧美| 在线91免费看| 26uuu亚洲| 亚洲欧洲国产专区| 亚洲在线观看免费视频| 日本欧美一区二区在线观看| 免费在线一区观看| 大桥未久av一区二区三区中文| 波多野结衣中文一区| 欧美吻胸吃奶大尺度电影 | 五月天精品一区二区三区| 麻豆国产欧美日韩综合精品二区 | 日韩欧美黄色影院| 国产精品天美传媒| 日韩中文字幕区一区有砖一区| 久久疯狂做爰流白浆xx| 99精品欧美一区二区三区综合在线| 久久久久久久久伊人| 亚洲福利电影网| 国产mv日韩mv欧美| 宅男在线国产精品| 亚洲免费观看高清完整版在线观看 | 亚洲大片一区二区三区| 高清不卡在线观看| 欧美一区二区三级| 一区二区高清免费观看影视大全 | 日韩欧美一区电影| 亚洲在线视频网站| 99re8在线精品视频免费播放| 欧美一级一级性生活免费录像| 日本一区二区久久| 麻豆国产精品777777在线| 在线看不卡av| 伊人性伊人情综合网| 不卡的av网站| 日韩一区在线看| gogo大胆日本视频一区| 亚洲国产精品精华液2区45| 国内久久精品视频| 久久在线观看免费| 久久精品国产成人一区二区三区| 在线不卡的av| 免费看欧美女人艹b| 精品久久久久久久久久久久久久久| 亚洲小说欧美激情另类| 在线观看不卡一区| 免费日本视频一区| 国产精品网站一区| 欧美日韩国产区一| 91片黄在线观看| 日韩黄色在线观看| 国产午夜精品一区二区三区视频| caoporm超碰国产精品| 一区二区三区高清| 日韩欧美不卡在线观看视频| 在线观看国产一区二区| 亚洲成人精品一区二区| 欧美精品一区二区三区四区 | 精品国产亚洲在线| 国产aⅴ综合色| 亚洲一区影音先锋| 国产视频在线观看一区二区三区| 色天天综合久久久久综合片| 日本女人一区二区三区| 国产精品电影一区二区三区| 欧美日韩成人激情| 粉嫩在线一区二区三区视频| 亚洲最新在线观看| 亚洲欧美综合网| 精品少妇一区二区三区免费观看| 91在线小视频| 99精品国产91久久久久久| 精品无人码麻豆乱码1区2区 | 91蜜桃免费观看视频| 国模冰冰炮一区二区| 日韩**一区毛片| 日韩av高清在线观看| 偷窥少妇高潮呻吟av久久免费| 国产精品午夜电影| 国产精品热久久久久夜色精品三区 | 久久国产精品色婷婷| 视频在线观看一区| 五月激情综合婷婷| 日本一区中文字幕| 日韩在线a电影| 久久精品国产免费看久久精品| 日韩黄色免费电影| 日韩电影在线免费| 免费看精品久久片| 欧日韩精品视频| 在线亚洲+欧美+日本专区| 色婷婷av一区二区三区软件| 欧美在线观看一区| 日韩精品在线一区二区| 久久综合色之久久综合| 国产清纯白嫩初高生在线观看91| 国产精品国产三级国产aⅴ无密码| 中文字幕精品—区二区四季| 一区二区成人在线观看| 视频一区二区国产| 国产美女视频91| 91浏览器打开| 日韩一区国产二区欧美三区| 亚洲精品在线免费播放| 国产精品美日韩| 美女爽到高潮91| 91免费在线看| 日韩精品一区二区三区蜜臀| 一区二区久久久久久| 国产电影精品久久禁18| 欧美二区三区91| 亚洲欧洲国产日韩| 国内成人免费视频|