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

📄 showarray.m

📁 实现了传感器定位时
💻 M
字号:
function showarray(Targets,NumSensors,Spacing)
% SHOWARRAY  Illustrate a sensor array with ideal sources
% Example:
%  showarray(Targets,NumSensors,Spacing)

numtargs=size(Targets,1);
orgx=(NumSensors+1)/2;

% Plot array
xs=(1:NumSensors)';
ys=zeros(NumSensors,1);
plot(xs,ys,'o');
axis([0 NumSensors+1 0 NumSensors+1]);
set(gca,'xtick',1:NumSensors);
set(gca,'ytick',[]);
hold on
xlabel(['Sensor spacing is ',num2str(Spacing), ' m']);
ylim([0 NumSensors/1.5])

% Normal to array
xs=ones(NumSensors,1).*orgx;
ys=(0:NumSensors-1)';
plot(xs,ys,'--k');
title([int2str(NumSensors),' sensor array with ' int2str(numtargs) ' sources']);

% Incident rays
for tar=1:numtargs
    bearing=.5*pi-Targets(tar,1);
    length_line=orgx;
    ray1x=length_line*cos(bearing)+orgx;
    ray1y=length_line*sin(bearing);
    plot([ray1x orgx]', [ray1y 0]','r');
   % text(['{\it\theta}_' int2str(tar)],[ray1x ray1y])
end

legend('Sensors','Direction of Array','Direction of Sources');
end

⌨️ 快捷键说明

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