²é¿´: 948  |  »Ø¸´: 3

ÓêÈË007

Òø³æ (СÓÐÃûÆø)

[ÇóÖú] MATLAB ÖÐÓйØgriddataµÄ¼ÆËãÔ­Àí£¬¿´²»¶®£¬ÇóÏê½â£¡

>>type griddata
function [xi,yi,zi] = gdatav4(x,y,z,xi,yi)
%GDATAV4 MATLAB 4 GRIDDATA interpolation

%   Reference:  David T. Sandwell, Biharmonic spline
%   interpolation of GEOS-3 and SEASAT altimeter
%   data, Geophysical Research Letters, 2, 139-142,
%   1987.  Describes interpolation using value or
%   gradient of value in any dimension.

xy = x( + y(*sqrt(-1);

% Determine distances between points
d = xy(:,ones(1,length(xy)));
d = abs(d - d.');
n = size(d,1);
% Replace zeros along diagonal with ones (so these don't show up in the
% find below or in the Green's function calculation).
d(1:n+1:numel(d)) = ones(1,n);

non = find(d == 0, 1);
if ~isempty(non),
  % If we've made it to here, then some points aren't distinct.  Remove
  % the non-distinct points by averaging.
  [r,c] = find(d == 0);
  k = find(r < c);
  r = r(k); c = c(k); % Extract unique (row,col) pairs
  v = (z(r) + z(c))/2; % Average non-distinct pairs
  
  rep = find(diff(c)==0);
  if ~isempty(rep), % More than two points need to be averaged.
    runs = find(diff(diff(c)==0)==1)+1;
    for i=1:length(runs),
      k = (c==c(runs(i))); % All the points in a run
      v(runs(i)) = mean(z([r(k);c(runs(i))])); % Average (again)
    end
  end
  z(r) = v;
  if ~isempty(rep),
    z(r(runs)) = v(runs); % Make sure average is in the dataset
  end

  % Now remove the extra points.
  z(c) = [];
  xy(c, = [];
  xy(:,c) = [];
  d(c, = [];
  d(:,c) = [];
  
  % Determine the non distinct points
  ndp = sort([r;c]);
  ndp(ndp(1:length(ndp)-1)==ndp(2:length(ndp))) = [];

  warning('MATLAB:griddata:NonDistinctPoints',['Averaged %d non-distinct ' ...
            'points.\n         Indices are: %s.'],length(ndp),num2str(ndp'))
end

% Determine weights for interpolation
g = (d.^2) .* (log(d)-1);   % Green's function.
% Fixup value of Green's function along diagonal
g(1:size(d,1)+1:numel(d)) = zeros(size(d,1),1);
weights = g \ z(;

[m,n] = size(xi);
zi = zeros(size(xi));
jay = sqrt(-1);
xy = xy.';

% Evaluate at requested points (xi,yi).  Loop to save memory.
for i=1:m
  for j=1:n
    d = abs(xi(i,j)+jay*yi(i,j) - xy);
    mask = find(d == 0);
    if ~isempty(mask), d(mask) = ones(length(mask),1); end
    g = (d.^2) .* (log(d)-1);   % Green's function.
    % Value of Green's function at zero
    if ~isempty(mask), g(mask) = zeros(length(mask),1); end
    zi(i,j) = g * weights;
  end
end

if nargout<=1,
  xi = zi;
end
»Ø¸´´ËÂ¥
Ïë×öµÄÊÂÇéµ²²»×¡£¡
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

acalephs

¾èÖú¹ó±ö (ÖøÃûдÊÖ)

ÄIJ»¶®
2Â¥2014-12-25 15:34:41
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

ÓêÈË007

Òø³æ (СÓÐÃûÆø)

ÒýÓûØÌû:
2Â¥: Originally posted by acalephs at 2014-12-25 15:34:41
ÄIJ»¶®

ÎÒÏëÖªµÀV4ÔõÑùʵÏÖ²åÖµµÄ£¬±ÈÈçÏßÐÔ²åÖµ£¬ÊǰÑÓë²åÖµµã¿¿½üµÄÁ½¸öÊý¾ÝÖ±½ÓÁ¬½Ó£¬È»ºóÔÚÖ±ÏßÉÏѡȡ¶ÔÓ¦²åÖµµãµÄÊý¾Ý¡£V4ÊǸù¾Ýʲô²åÖµµÄ
Ïë×öµÄÊÂÇéµ²²»×¡£¡
3Â¥2014-12-26 10:07:04
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

acalephs

¾èÖú¹ó±ö (ÖøÃûдÊÖ)

ÒýÓûØÌû:
3Â¥: Originally posted by ÓêÈË007 at 2014-12-26 10:07:04
ÎÒÏëÖªµÀV4ÔõÑùʵÏÖ²åÖµµÄ£¬±ÈÈçÏßÐÔ²åÖµ£¬ÊǰÑÓë²åÖµµã¿¿½üµÄÁ½¸öÊý¾ÝÖ±½ÓÁ¬½Ó£¬È»ºóÔÚÖ±ÏßÉÏѡȡ¶ÔÓ¦²åÖµµãµÄÊý¾Ý¡£V4ÊǸù¾Ýʲô²åÖµµÄ...

²Î¿¼ÎÄÏ×Ó¦¸ÃÓÐ˵Ã÷°É£¬ÆäʵÎÒÒ²²»Çå³þ¡£¡£¡£
4Â¥2015-01-13 20:01:38
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ ÓêÈË007 µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] Ò»Ö¾Ô¸Î÷ÄϽ»Í¨ ר˶ ²ÄÁÏ355 ±¾¿ÆË«·Ç Çóµ÷¼Á +3 Î÷ÄϽ»Í¨×¨²Ä355 2026-03-19 3/150 2026-03-20 09:34 by ÿÌìÖ»°ÚһС»á
[¿¼ÑÐ] 085410È˹¤ÖÇÄÜר˶317Çóµ÷¼Á£¨0854¶¼¿ÉÒÔ£© +4 xbxudjdn 2026-03-18 4/200 2026-03-20 09:07 by ²»168
[¿¼ÑÐ] 279·ÖÇóµ÷¼Á Ò»Ö¾Ô¸211 +7 chaojifeixia 2026-03-19 7/350 2026-03-20 09:00 by sunny300
[¿¼ÑÐ] Çóµ÷¼Á +3 °µÓ¿afhb 2026-03-16 3/150 2026-03-20 00:28 by ºÓÄÏ´óѧУÓÑ
[¿¼ÑÐ] Ò»Ö¾Ô¸¼ªÁÖ´óѧ²ÄÁÏѧ˶321Çóµ÷¼Á +9 Ymlll 2026-03-18 12/600 2026-03-20 00:01 by 23Postgrad
[¿¼ÑÐ] 307Çóµ÷¼Á +9 ÀäóÏ123 2026-03-17 9/450 2026-03-19 22:44 by ѧԱ8dgXkO
[¿¼ÑÐ] ¸´ÊÔµ÷¼Á +4 z1z2z3879 2026-03-14 6/300 2026-03-19 17:18 by fei626-918
[¿¼ÑÐ] 085600²ÄÁÏÓ뻯¹¤µ÷¼Á 324·Ö +10 llllkkkhh 2026-03-18 12/600 2026-03-19 14:33 by llllkkkhh
[¿¼ÑÐ] Çóµ÷¼Á +3 Mqqqqqq 2026-03-19 3/150 2026-03-19 14:11 by peike
[¿¼ÑÐ] 0703»¯Ñ§ 305Çóµ÷¼Á +4 FY_yy 2026-03-14 4/200 2026-03-19 05:54 by anny19840123
[¿¼ÑÐ] 344Çóµ÷¼Á +6 knight344 2026-03-16 7/350 2026-03-18 20:13 by walc
[¿¼ÑÐ] ²ÄÁÏר˶306Ó¢Ò»Êý¶þ +10 z1z2z3879 2026-03-16 13/650 2026-03-18 14:20 by 007_lilei
[¿¼ÑÐ] ¹¤¿Æ²ÄÁÏ085601 279Çóµ÷¼Á +6 À§ÓÚÐdz¿ 2026-03-17 6/300 2026-03-18 10:21 by kkcoco25
[¿¼ÑÐ] ÉúÎïѧ071000 329·ÖÇóµ÷¼Á +3 ÎÒ°®ÉúÎïÉúÎﰮΠ2026-03-17 3/150 2026-03-18 10:12 by macy2011
[¿¼ÑÐ] »·¾³¹¤³Ìµ÷¼Á +8 ´ó¿Édigkids 2026-03-16 8/400 2026-03-18 09:36 by zhukairuo
[¿¼ÑÐ] 293Çóµ÷¼Á +11 zjlµÄºÅ 2026-03-16 16/800 2026-03-18 08:10 by zhukairuo
[¿¼ÑÐ] Ò»Ö¾Ô¸ÄϾ©´óѧ£¬080500²ÄÁÏ¿ÆÑ§Ó빤³Ì£¬µ÷¼Á +4 Jy? 2026-03-16 4/200 2026-03-17 11:02 by gaoqiong
[¿¼ÑÐ] »úеר˶325£¬Ñ°ÕÒµ÷¼ÁԺУ +3 y9999 2026-03-15 5/250 2026-03-16 19:58 by y9999
[¿¼ÑÐ] 326Çóµ÷¼Á +3 mlpqaz03 2026-03-15 3/150 2026-03-16 07:33 by Iveryant
[¿¼ÑÐ] 266Çóµ÷¼Á +4 ѧԱ97LZgn 2026-03-13 4/200 2026-03-14 08:37 by zhukairuo
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û