24小时热门版块排行榜    

查看: 4229  |  回复: 7

雨人007

银虫 (小有名气)

[求助] MATLAB 中V4插值原理和计算步骤,急求!

MATLAB 中V4插值原理和计算步骤,求大神详解!
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

想做的事情挡不住!
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Kevlar_J

铜虫 (正式写手)

看帮助文件有没有?

[ 发自小木虫客户端 ]
振叶以寻根,观澜而溯源!www.source-grid.com
2楼2014-12-24 00:39:11
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

雨人007

银虫 (小有名气)

引用回帖:
2楼: Originally posted by Kevlar_J at 2014-12-24 00:39:11
看帮助文件有没有?

查了好多,有的也只是一概而过
想做的事情挡不住!
3楼2014-12-24 16:38:22
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Kevlar_J

铜虫 (正式写手)

引用回帖:
3楼: Originally posted by 雨人007 at 2014-12-24 16:38:22
查了好多,有的也只是一概而过...

我觉得v4是他们自己算法,应该不会全部公开

[ 发自小木虫客户端 ]
振叶以寻根,观澜而溯源!www.source-grid.com
4楼2014-12-24 23:21:26
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

雨人007

银虫 (小有名气)

引用回帖:
4楼: Originally posted by Kevlar_J at 2014-12-24 23:21:26
我觉得v4是他们自己算法,应该不会全部公开
...

从MATLAB中找出的源程序,直接不懂!
>>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
想做的事情挡不住!
5楼2014-12-25 10:22:14
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Kevlar_J

铜虫 (正式写手)

引用回帖:
5楼: Originally posted by 雨人007 at 2014-12-25 10:22:14
从MATLAB中找出的源程序,直接不懂!
>>type griddata
function  = gdatav4(x,y,z,xi,yi)
%GDATAV4 MATLAB 4 GRIDDATA interpolation

%   Reference:  David T. Sandwell, Biharmonic spline
%   int ...

这说的我也不懂,我觉得一句句翻译成数学语言,应该可以理解的,别急,慢慢看

[ 发自小木虫客户端 ]
振叶以寻根,观澜而溯源!www.source-grid.com
6楼2014-12-25 12:11:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Kevlar_J

铜虫 (正式写手)

引用回帖:
5楼: Originally posted by 雨人007 at 2014-12-25 10:22:14
从MATLAB中找出的源程序,直接不懂!
>>type griddata
function  = gdatav4(x,y,z,xi,yi)
%GDATAV4 MATLAB 4 GRIDDATA interpolation

%   Reference:  David T. Sandwell, Biharmonic spline
%   int ...

有什么不懂到matlab爱好者论坛问问,哪里大神多

[ 发自小木虫客户端 ]
振叶以寻根,观澜而溯源!www.source-grid.com
7楼2014-12-25 12:12:29
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

雨人007

银虫 (小有名气)

引用回帖:
7楼: Originally posted by Kevlar_J at 2014-12-25 12:12:29
有什么不懂到matlab爱好者论坛问问,哪里大神多
...

多谢啊!
想做的事情挡不住!
8楼2014-12-26 10:02:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 雨人007 的主题更新
信息提示
请填处理意见