📄 euclide.m
字号:
function [s,V] = euclide(z,rho,theta)% function EUCLIDE.M% Nearest neighbor approximation algorithm
%% Usage: [s,V] = euclide(z,rho,theta)% Where: z = M by N matrix with samples in frequency domain % rho, theta = radius and angles ofdata points% interpolated niattix% V = vector that includes [X0 dkx dky fl]close all% Variables burstsbursts = size(z,1);pul_burst = size(z,2);rho = rho.*(4*pi/3e8); %% frequency matrix in rad/mtrhov = rho(1,:);drho = rhov(2) - rhov(1);ac = theta(bursts,1) - theta(1,pul_burst);% Points of Interpolationx = linspace(min(rhov), max(rhov)*cos(ac/2),pul_burst);y = min(rhov)*tan(ac/2)*linspace(-1,1,bursts);[fxi,fyi] = meshgrid(x,y);fxd = rho.*cos(theta);fyd = rho.*sin(theta);dkx = fxi(1,2) - fxi(1,1);dky = fyi(2,1) - fyi(1,1);X0 = pi/(rhov(2) - rhov(1));% Interpolationflops(0)s = zeros(size(z));for a = 1:bursts,a for b = 1:pul_burst, rr = sqrt(fxi(a,b)^2 + fyi(a,b)^2); tt = atan2(fyi(a,b),fxi(a,b)); n = 1 + fix((rr - min(rhov))/drho); c = rr - (min(rhov) + drho*(n-1)); t2 = (theta(:,n+1) - theta(:,n))*c/drho + theta(:,n); if a==128 tt=tt-0.001; end k = min(find(tt<t2)) - 1; vx = [fxd(k,n) fxd(k+1,n) fxd(k+1,n+1) fxd(k,n+1)]; vy = [fyd(k,n) fyd(k+1,n) fyd(k+1,n+1) fyd(k,n+1)]; d = sqrt((fxi(a,b)-vx).^2 + (fyi(a,b)-vy).^2); s(a,b)=z(k,n)/d(1)+z(k+1,n)/d(2)+z(k+1,n+1)/d(3)+z(k,n+1)/d(4); s(a,b)=s(a,b)/sum(1./d);end; endfl = flops;
V = [X0 dkx dky fl];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -