| 5 | 1/1 | 返回列表 |
| 查看: 4292 | 回復(fù): 7 | ||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | ||
雨人007銀蟲 (小有名氣)
|
[求助]
MATLAB 中V4插值原理和計(jì)算步驟,急求!
|
|
| MATLAB 中V4插值原理和計(jì)算步驟,求大神詳解! |



銀蟲 (小有名氣)

銀蟲 (小有名氣)
|
從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 |

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 086502化學(xué)工程342求調(diào)劑 +5 | 阿姨復(fù)古不過 2026-03-27 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 289求調(diào)劑 +8 | 新時(shí)代材料 2026-03-27 | 8/400 |
|
|
[考研] 315分求調(diào)劑 +7 | 26考研上岸版26 2026-03-26 | 7/350 |
|
|
[考研] 283求調(diào)劑(080500) +4 | A child 2026-03-27 | 4/200 |
|
|
[考研] 一志愿北京化工大學(xué)材料與化工 264分各科過A區(qū)國家線 +10 | 哈哈157349 2026-03-21 | 10/500 |
|
|
[考研]
|
孅華 2026-03-22 | 16/800 |
|
|
[考研] 286求調(diào)劑 +4 | lim0922 2026-03-26 | 4/200 |
|
|
[考研] 材料學(xué)碩333求調(diào)劑 +8 | 北道巷 2026-03-24 | 8/400 |
|
|
[考研]
|
鐘llll 2026-03-26 | 4/200 |
|
|
[考研] 341求調(diào)劑 +7 | 青檸檬1 2026-03-26 | 7/350 |
|
|
[考研] 081200-11408-276學(xué)碩求調(diào)劑 +3 | 崔wj 2026-03-26 | 3/150 |
|
|
[考研] 環(huán)境專碩324分求調(diào)劑推薦 +5 | 軒小寧—— 2026-03-26 | 5/250 |
|
|
[考研] 一志愿上海交大生物與醫(yī)藥專碩324分,求調(diào)劑 +6 | jiajunX 2026-03-22 | 6/300 |
|
|
[考研] 07化學(xué)303求調(diào)劑 +5 | 睿08 2026-03-25 | 5/250 |
|
|
[考研] 318求調(diào)劑 +5 | plum李子 2026-03-21 | 8/400 |
|
|
[考研] 291求調(diào)劑 +3 | HanBeiNingZC 2026-03-24 | 3/150 |
|
|
[考研]
|
酥酥魚.. 2026-03-21 | 4/200 |
|
|
[考研] 石河子大學(xué)(211、雙一流)碩博研究生長(zhǎng)期招生公告 +3 | 李子目 2026-03-22 | 3/150 |
|
|
[考研] 生物學(xué)調(diào)劑 +5 | Surekei 2026-03-21 | 5/250 |
|
|
[考研] 一志愿北京化工大學(xué)070300 學(xué)碩336求調(diào)劑 +5 | vv迷 2026-03-21 | 8/400 |
|