资源简介
MATGPR_R3 探地雷达数据分析、处理程序。基于MATLAB的雷达波探测处理分析,开源程序。
代码片段和文件信息
function [x0y0] = centroid(xy)
%
% CENTROID Center of mass of a polygon.
%
% [X0Y0] = CENTROID(XY)
%
% Calculates centroid (center of mass) of planar polygon with vertex
% coordinates X Y.
% Z0 = CENTROID(X+i*Y) returns Z0=X0+i*Y0 the same as CENTROID(XY).
%
% Copyright (c) 1995 by Kirill K. Pankratov
% kirill@plume.mit.edu.
% 06/01/95 06/07/95
%
% Algorithm:
% X0 = Int{x*ds}/Int{ds} where ds - area element
% so that Int{ds} is total area of a polygon.
% Using Green‘s theorem the area integral can be
% reduced to a contour integral:
% Int{x*ds} = -Int{x^2*dy} Int{ds} = Int{x*dy}
% along the perimeter of a polygon.
% For a polygon as a sequence of line segments
% this can be reduced exactly to a sum:
% Int{x^2*dy} = Sum{ (x_{i}^2+x_{i+1}^2+x_{i}*x_{i+1})*(y_{i+1}-y_{i})}/3;
% Int{x*dy} = Sum{(x_{i}+x_{i+1})(y_{i+1}-y_{i})}/2.
% Similarly
% Y0 = Int{y*ds}/Int{ds}
% where
% Int{y*ds} = Int{y^2*dx} = ...
% = Sum{ (y_{i}^2+y_{i+1}^2+y_{i}*y_{i+1})*(x_{i+1}-x_{i})}/3.
%
% Handle input ......................
if nargin==0 help centroid return end
if nargin==1
sz = size(x);
if sz(1)==2 % Matrix 2 by n
y = x(2:); x = x(1:);
elseif sz(2)==2 % Matrix n by 2
y = x(:2); x = x(:1);
else
y = imag(x);
x = real(x);
end
end
% Make a polygon closed ..............
x = [x(:); x(1)];
y = [y(:); y(1)];
% Check length .......................
l = length(x);
if length(y)~=l
error(‘ Vectors x and y must have the same length‘)
end
% X-mean: Int{x^2*dy} ................
del = y(2:l)-y(1:l-1);
v = x(1:l-1).^2+x(2:l).^2+x(1:l-1).*x(2:l);
x0 = v‘*del;
% Y-mean: Int{y^2*dx} ................
del = x(2:l)-x(1:l-1);
v = y(1:l-1).^2+y(2:l).^2+y(1:l-1).*y(2:l);
y0 = v‘*del;
% Calculate area: Int{y*dx} ..........
a = (y(1:l-1)+y(2:l))‘*del;
tol= 2*eps;
if abs(a) < tol
disp(‘ Warning: area of polygon is close to 0‘)
a = a+sign(a)*tol+(~a)*tol;
end
% Multiplier
a = 1/3/a;
% Divide by area .....................
x0 = -x0*a;
y0 = y0*a;
if nargout < 2 x0 = x0+1i*y0; end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-04-08 22:05 MATGPR_R3\
目录 0 2016-04-08 22:03 MATGPR_R3\analysis\
目录 0 2014-01-20 21:00 MATGPR_R3\analysis\alternative\
目录 0 2014-01-20 21:00 MATGPR_R3\analysis\alternative\gazdagmig+migrate.f90\
文件 1697 2013-11-18 23:10 MATGPR_R3\analysis\alternative\gazdagmig+migrate.f90\gazdagmig.p
文件 170496 2004-03-30 02:40 MATGPR_R3\analysis\alternative\gazdagmig+migrate.f90\migrate.exe
文件 9368 2004-03-30 02:40 MATGPR_R3\analysis\alternative\gazdagmig+migrate.f90\migrate.f90
目录 0 2014-01-20 21:00 MATGPR_R3\analysis\alternative\Splitstep_model+radar2d4.f90\
文件 477244 2006-01-04 04:28 MATGPR_R3\analysis\alternative\Splitstep_model+radar2d4.f90\radar2d4.exe
文件 32077 2006-01-04 04:28 MATGPR_R3\analysis\alternative\Splitstep_model+radar2d4.f90\radar2d4.f90
文件 2209 2013-11-18 23:12 MATGPR_R3\analysis\alternative\Splitstep_model+radar2d4.f90\splitstep2dmodel.p
文件 931 2013-11-18 21:48 MATGPR_R3\analysis\BSplineWaveletFilter.p
文件 7739 2016-04-01 17:34 MATGPR_R3\analysis\build2dmodel.p
文件 268 2013-11-18 21:49 MATGPR_R3\analysis\cbspldv.p
文件 826 2016-04-01 17:34 MATGPR_R3\analysis\cbsplwv.p
文件 2161 2013-10-25 14:31 MATGPR_R3\analysis\centroid.m
文件 1437 2013-12-18 01:57 MATGPR_R3\analysis\CentroidFrequency.p
文件 1976 2014-11-13 01:29 MATGPR_R3\analysis\CurveletFilter.p
文件 4393 2014-11-13 01:28 MATGPR_R3\analysis\CurveletSelectCoefficients.p
文件 369 2013-11-18 21:49 MATGPR_R3\analysis\dewow.p
文件 2728 2016-04-01 17:34 MATGPR_R3\analysis\editmarkers.p
文件 2225 2013-11-19 16:42 MATGPR_R3\analysis\editscanaxis.p
文件 1527 2013-11-18 21:49 MATGPR_R3\analysis\equalize.p
文件 2079 2013-11-19 22:50 MATGPR_R3\analysis\fdct_wrapping.p
文件 252 2013-11-19 22:50 MATGPR_R3\analysis\fdct_wrapping_window.p
目录 0 2014-04-28 19:36 MATGPR_R3\analysis\fdtd\
文件 957 2013-10-26 12:21 MATGPR_R3\analysis\fdtd\blackharrispulse.m
文件 1001 2013-10-26 12:18 MATGPR_R3\analysis\fdtd\finddt.m
文件 2200 2013-10-26 11:51 MATGPR_R3\analysis\fdtd\finddx.m
文件 2135 2014-04-28 19:36 MATGPR_R3\analysis\fdtd\getemproperties.p
文件 828 2013-10-26 12:17 MATGPR_R3\analysis\fdtd\gridinterp.m
............此处省略520个文件信息
评论
共有 条评论