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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? interp2.m

?? 這是一個(gè)整理后比較全面的數(shù)學(xué)建模所用到的基本的十種計(jì)算方法的matlab源代碼!
?? M
?? 第 1 頁 / 共 2 頁
字號:
function zi = interp2(varargin)
%二元函數(shù)網(wǎng)格數(shù)據(jù)的插值
%ZI=interp2(X,Y,Z,XI,YI,'方法')  求二元函數(shù)z=f(x,y)的插值. 
%   這里X,Y,Z是同維數(shù)矩陣表示網(wǎng)格數(shù)據(jù),XI,YI,ZI是同維數(shù)矩陣表示插值點(diǎn).
%或ZI=interp2(x,y,z,xi,yi)其中,x,xi為行向量,y,yi為列向量.
%  'bilinear',使用雙線性插值(默認(rèn))
%  '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);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品国内一区二区三区| 一区二区三区日韩精品视频| 免费成人你懂的| 欧美日韩精品一区二区天天拍小说| 亚洲一区二区三区在线| 欧美三级午夜理伦三级中视频| 亚洲第一成年网| 欧美成人bangbros| 国产·精品毛片| 樱花影视一区二区| 欧美日韩国产精品成人| 免费成人美女在线观看.| 国产色综合久久| 色屁屁一区二区| 蜜臀av一区二区| 国产精品素人视频| 欧美在线一二三四区| 麻豆一区二区99久久久久| 国产亚洲成av人在线观看导航| 国产98色在线|日韩| 亚洲欧美日本在线| 欧美一卡在线观看| 成人午夜在线免费| 亚洲高清中文字幕| 久久久精品日韩欧美| 91视频免费播放| 蜜桃视频在线观看一区二区| 国产精品天干天干在线综合| 欧美人妖巨大在线| 国产精品18久久久久久vr| 一区二区三区日韩欧美| 337p日本欧洲亚洲大胆精品 | 91精品国产综合久久精品性色 | 国产精品中文字幕日韩精品| 亚洲欧美日韩国产综合| 日韩三区在线观看| 色偷偷88欧美精品久久久| 精品一区二区成人精品| 亚洲激情图片qvod| 久久久久久久久久久电影| 欧美日韩免费观看一区三区| 国产夫妻精品视频| 蜜乳av一区二区| 一区二区三区在线观看欧美| 午夜免费久久看| 国产精品国产自产拍高清av| 欧美不卡一区二区三区四区| 在线一区二区三区四区五区| 国产成人综合视频| 久久精品国产精品亚洲红杏| 亚洲午夜精品网| 国产精品福利影院| 国产亚洲综合性久久久影院| 欧美一区二区久久| 欧美视频一二三区| 91在线码无精品| 成人性生交大片免费看在线播放| 久久不见久久见免费视频7 | 欧美高清视频一二三区 | 香蕉久久一区二区不卡无毒影院| 中文字幕va一区二区三区| 日韩精品一区二| 51精品国自产在线| 欧美日韩国产小视频在线观看| 99re这里都是精品| 91日韩在线专区| av网站一区二区三区| 国产91在线观看丝袜| 国产成人综合网站| 国产成人啪午夜精品网站男同| 国内一区二区在线| 国产综合成人久久大片91| 久久精品国产**网站演员| 蜜桃久久av一区| 免费人成精品欧美精品 | 亚洲欧洲av另类| 国产日韩欧美精品电影三级在线| 日韩精品一区二区三区中文不卡| 日韩三级精品电影久久久 | 国产精品美女久久久久av爽李琼 | 精品视频资源站| 欧美视频一区二区三区四区| 欧美性猛交xxxxxx富婆| 欧美性xxxxxx少妇| 欧美日本在线观看| 91麻豆精品国产自产在线观看一区 | 色婷婷综合视频在线观看| 91免费在线看| 欧美日韩一级黄| 91精品麻豆日日躁夜夜躁| 日韩免费一区二区| 久久一留热品黄| 国产精品久久久久精k8| 亚洲精品欧美在线| 日韩vs国产vs欧美| 国产一区二区久久| bt7086福利一区国产| 在线免费一区三区| 日韩欧美国产麻豆| 久久久久久久久久久黄色| 国产欧美日韩卡一| 亚洲激情欧美激情| 免费在线视频一区| 国产91精品露脸国语对白| 在线免费观看日本一区| 欧美一级片在线| 中文欧美字幕免费| 亚洲一区二区三区四区不卡| 麻豆精品新av中文字幕| 国产成人精品一区二| 91成人在线观看喷潮| 日韩精品一区二区三区四区视频 | 蜜乳av一区二区| 大尺度一区二区| 亚洲精品高清在线观看| 日本女人一区二区三区| 高清不卡一区二区在线| 欧美亚洲综合在线| 久久久久九九视频| 亚洲妇熟xx妇色黄| 国产成人av一区二区三区在线观看| 色婷婷国产精品| 久久久精品免费网站| 亚洲电影第三页| 成人一道本在线| 欧美一区二区福利在线| 亚洲三级在线看| 激情综合色播五月| 在线观看av不卡| 中文子幕无线码一区tr| 天堂蜜桃91精品| 97se亚洲国产综合自在线| 精品国产区一区| 亚洲成人一二三| 色综合久久综合网欧美综合网 | 精品久久久久久久久久久院品网| 亚洲国产精品99久久久久久久久| 天天色 色综合| 91麻豆.com| 国产日韩欧美精品在线| 精品一区二区三区在线观看| 欧美三级视频在线观看| 亚洲桃色在线一区| 国产.精品.日韩.另类.中文.在线.播放| 欧美乱熟臀69xxxxxx| 亚洲精品久久久久久国产精华液| 国产成人自拍高清视频在线免费播放| 51午夜精品国产| 91丨porny丨国产| 欧美激情综合五月色丁香| 蜜桃视频在线观看一区| 91麻豆精品国产自产在线| 亚洲永久精品大片| 色又黄又爽网站www久久| 国产精品久久久久久久久久久免费看| 久久99国产精品久久99| 欧美一区二区精品| 日本中文字幕一区二区有限公司| 色婷婷av一区| 一级特黄大欧美久久久| 91丝袜美女网| 亚洲免费观看高清完整版在线观看熊 | 国产日产欧美一区| 国产剧情一区二区| 久久久久久久免费视频了| 久久精品国产在热久久| 日韩欧美一区二区免费| 久久精品国产亚洲a| 精品福利二区三区| 国产毛片精品国产一区二区三区| 精品国产一区二区三区忘忧草| 麻豆精品久久久| 精品欧美乱码久久久久久1区2区 | 国内精品在线播放| 久久精品一区蜜桃臀影院| 国产原创一区二区三区| 久久精品视频在线免费观看| 国产成人免费av在线| 国产精品灌醉下药二区| 91丝袜高跟美女视频| 亚洲午夜久久久久久久久久久| 欧美美女一区二区| 久久99精品久久久久久| 国产欧美日产一区| 在线免费视频一区二区| 日本特黄久久久高潮| www久久久久| 成人午夜视频网站| 亚洲一区二区三区视频在线 | 亚洲狼人国产精品| 欧美午夜片在线观看| 轻轻草成人在线| 久久久.com| 在线亚洲人成电影网站色www| 亚洲成av人片在www色猫咪| 欧美电视剧在线看免费| av成人免费在线| 亚洲高清在线视频| 久久久亚洲午夜电影| 色八戒一区二区三区|