⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plothyperbolas.m

📁 基于声源的方向定位程序
💻 M
字号:
function useful = plotHyperbolas(d, tolerance, arr, m1, m2, c, limits)% useful = plotHyperbolas(d, tolerance, arr, m1, m2, c, limits)% Plot one or more hyperbolas on the current plot.  Leaves hold on.%% Inputs:%    d		time delay, seconds, between pairs of phones%    tolerance	error in time delay; if [], a default is guessed at%    arr	phone positions, m (indexed by m1, m2)%    m1		phone 1 number (indices are same as d's)%    m2		phone 2 number (indices are same as d's)%    c		speed of sound, m/s%    limits	(optional) x- and y-limits of plot, [xMin xMax yMin yMax]% Output:%    useful	says whether each time delay is useful (is less than max delay)global phColorNum		% next color to plot inif (nargin < 6), limits = []; endif (~exist('phColorNum'))  % MATLAB stupidity: exist() changed from v4.2 to v5  phColorNum = [];endif (isempty(phColorNum))  phColorNum = 1;endcolors = 'bywcmrg';if (isempty(tolerance))  tolerance = defaultTolerance(d);endif (isempty(limits))  limits = defaultLimits(arr);endphone1xy = arr(:,m1);phone2xy = arr(:,m2);clfhold onplot(arr(1,:), arr(2,:), '*')for i = 1:length(d)  maxDelay = sqrt(sum((phone1xy(:,i) - phone2xy(:,i)) .^ 2)) / c;  % Plot two hyperbolas, one on either side, using the tolerance.  useful(i) = (abs(d(i)) < maxDelay);  d1 = d(i) - tolerance;  d2 = d(i) + tolerance;  if (abs(d1) < maxDelay)    [dummy,obj] = PlotHyperbola(...	phone1xy(1,i), phone1xy(2,i), phone2xy(1,i), phone2xy(2,i), d1*c/2,...	limits(1), limits(2), limits(3), limits(4), colors(phColorNum));    set(obj, 'UserData', [m1(i) m2(i) d1 maxDelay], ...	'ButtonDownFcn', 'disp(get(gco, ''UserData''))');  end  if (tolerance > 0 & abs(d2) < maxDelay)    [dummy,obj] = PlotHyperbola(...	phone1xy(1,i), phone1xy(2,i), phone2xy(1,i), phone2xy(2,i), d2*c/2,...	limits(1), limits(2), limits(3), limits(4), colors(phColorNum));    set(obj, 'UserData', [m1(i) m2(i) d2 maxDelay], ...	'ButtonDownFcn', 'disp(get(gco, ''UserData''))');  end  phColorNum = rem(phColorNum, length(colors)) + 1;endhold offdrawnow

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -