| 8 | 1/1 | 返回列表 |
| 查看: 4282 | 回復: 7 | ||
雨人007銀蟲 (小有名氣)
|
[求助]
MATLAB 中V4插值原理和計算步驟,急求!
|
| MATLAB 中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 |



銀蟲 (小有名氣)

| 8 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 323求調(diào)劑 +6 | 洼小桶 2026-03-18 | 6/300 |
|
|---|---|---|---|---|
|
[考研] 311求調(diào)劑 +6 | 冬十三 2026-03-18 | 6/300 |
|
|
[考研] 284求調(diào)劑 +5 | Zhao anqi 2026-03-22 | 5/250 |
|
|
[考博] 招收博士1-2人 +3 | QGZDSYS 2026-03-18 | 4/200 |
|
|
[考研] 材料工程專碩 348分求調(diào)劑 +3 | 冬辭. 2026-03-17 | 5/250 |
|
|
[考研] 求調(diào)劑 +3 | 13341 2026-03-20 | 3/150 |
|
|
[考研] 【考研調(diào)劑】化學專業(yè) 281分,一志愿四川大學,誠心求調(diào)劑 +11 | 吃吃吃才有意義 2026-03-19 | 11/550 |
|
|
[考研] 求助 +5 | 夢里的無言 2026-03-21 | 6/300 |
|
|
[考研] 22 350 本科985求調(diào)劑,求老登收留 +3 | 李軼男003 2026-03-20 | 3/150 |
|
|
[考研] 279分求調(diào)劑 一志愿211 +14 | chaojifeixia 2026-03-19 | 15/750 |
|
|
[考研] 332求調(diào)劑 +3 | 鳳凰院丁真 2026-03-20 | 3/150 |
|
|
[考研] 材料工程(專)一志愿985 初試335求調(diào)劑 +3 | hiloiy 2026-03-17 | 4/200 |
|
|
[考研] 324分 085600材料化工求調(diào)劑 +4 | llllkkkhh 2026-03-18 | 4/200 |
|
|
[考研] 一志愿蘇州大學材料求調(diào)劑,總分315(英一) +5 | sbdksD 2026-03-19 | 5/250 |
|
|
[考研] 求調(diào)劑一志愿南京航空航天大學289分 +3 | @taotao 2026-03-19 | 3/150 |
|
|
[考研] 295材料求調(diào)劑,一志愿武漢理工085601專碩 +5 | Charlieyq 2026-03-19 | 5/250 |
|
|
[考研] 廣西大學家禽遺傳育種課題組2026年碩士招生(接收計算機專業(yè)調(diào)劑) +3 | 123阿標 2026-03-17 | 3/150 |
|
|
[考研] 081700化工學碩調(diào)劑 +3 | 【1】 2026-03-16 | 3/150 |
|
|
[考研] 一志愿福大288有機化學,求調(diào)劑 +3 | 小木蟲200408204 2026-03-18 | 3/150 |
|
|
[考博] 26申博 +4 | 八6八68 2026-03-16 | 4/200 |
|