| 8 | 1/1 | 返回列表 |
| 查看: 4284 | 回復(fù): 7 | ||
雨人007銀蟲(chóng) (小有名氣)
|
[求助]
MATLAB 中V4插值原理和計(jì)算步驟,急求!
|
| MATLAB 中V4插值原理和計(jì)算步驟,求大神詳解! |


銀蟲(chóng) (小有名氣)


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



銀蟲(chóng) (小有名氣)

| 8 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 【雙一流院校新能源、環(huán)境材料,材料加工與模擬招收大量調(diào)劑】 +4 | Higraduate 2026-03-22 | 7/350 |
|
|---|---|---|---|---|
|
[考研] 298-一志愿中國(guó)農(nóng)業(yè)大學(xué)-求調(diào)劑 +11 | 手機(jī)用戶(hù) 2026-03-17 | 12/600 |
|
|
[考研] 341求調(diào)劑(一志愿湖南大學(xué)070300) +5 | 番茄頭--- 2026-03-22 | 6/300 |
|
|
[考研] 材料292調(diào)劑 +4 | 橘頌思美人 2026-03-23 | 4/200 |
|
|
[考研] 一志愿211 初試270分 求調(diào)劑 +4 | 谷雨上岸 2026-03-23 | 5/250 |
|
|
[考研] 317求調(diào)劑 +12 | 申子申申 2026-03-19 | 18/900 |
|
|
[考研] 生物學(xué)071000 329分求調(diào)劑 +5 | 我愛(ài)生物生物愛(ài)?/a> 2026-03-17 | 5/250 |
|
|
[考研] 285求調(diào)劑 +6 | ytter 2026-03-22 | 6/300 |
|
|
[基金申請(qǐng)] 山東省面上項(xiàng)目限額評(píng)審 +4 | 石瑞0426 2026-03-19 | 4/200 |
|
|
[考研] 286分人工智能專(zhuān)業(yè)請(qǐng)求調(diào)劑愿意跨考! +4 | lemonzzn 2026-03-17 | 8/400 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | 妮妮ninicgb 2026-03-21 | 4/200 |
|
|
[考研] 297求調(diào)劑 +3 | 喜歡還是不甘心 2026-03-20 | 3/150 |
|
|
[考研] 278求調(diào)劑 +9 | 煙火先于春 2026-03-17 | 9/450 |
|
|
[考研] 313求調(diào)劑 +4 | 肆叁貳壹22 2026-03-19 | 4/200 |
|
|
[考研] 求調(diào)劑 +3 | Ma_xt 2026-03-17 | 3/150 |
|
|
[考研] 324分 085600材料化工求調(diào)劑 +4 | llllkkkhh 2026-03-18 | 4/200 |
|
|
[考研] 一志愿中海洋材料工程專(zhuān)碩330分求調(diào)劑 +8 | 小材化本科 2026-03-18 | 8/400 |
|
|
[考研] 一志愿吉林大學(xué)材料學(xué)碩321求調(diào)劑 +11 | Ymlll 2026-03-18 | 15/750 |
|
|
[考研] 求調(diào)劑 +3 | @taotao 2026-03-20 | 3/150 |
|
|
[論文投稿]
申請(qǐng)回稿延期一個(gè)月,編輯同意了。但系統(tǒng)上的時(shí)間沒(méi)變,給編輯又寫(xiě)郵件了,沒(méi)回復(fù)
10+3
|
wangf9518 2026-03-17 | 4/200 |
|