Files
RadarSingalAnalyzer/crosslocation.m
shuibing811 f3cfdb677b ---
2025-01-25 16:26:42 +08:00

61 lines
2.3 KiB
Matlab

close all
clear all
station = [31.2304, 121.4737,0;
31.5200, 121.6400,0
];
Target = [31.2550, 121.4890,0; % 目标1 陆
31.2800, 121.5200,0; % 目标2 陆
31.1900, 121.4800,0; % 目标3 陆
31.2700, 121.5500,0; % 目标4 陆
31.2000, 121.6000,0; % 目标5 陆
30.9500, 121.6500,0; % 目标6 海
30.8500, 121.7200,0; % 目标7 海
30.7800, 121.8000,0; % 目标8 海
30.9200, 121.8500,0; % 目标9 海
30.6700, 121.9000,0; % 目标10 海
];
num = size(station,1); % 观测站数目
load('RadarPDW_pri_modulation.mat');%数据加载
for i = 1:num
[station1_enu(i,1) ,station1_enu(i,2) , station1_enu(i,3)]= lla2enu(station(i,:),station(1,:)); % 坐标转换
end
for idx = 1:length(RadarPDW)
DOA = RadarPDW(idx).DOA;
for i = 1 : length(DOA)
[Xls1_ned] = LeastSquare(DOA(i,:) ,station1_enu(:,1)',station1_enu(:,2)');
[radi(1,1),radi(1,2)] = ned2lla([Xls1_ned(1),Xls1_ned(2),0],station(1,:)); % 坐标转换
erro(i) = distance(Target(1,1),Target(1,2),radi(1,1),radi(1,2)); % 计算误差1
location_estimated(i,:) = [radi(1,1),radi(1,2),0];
end
for i = 1:length(RadarPDW(idx).PRI)
RadarPDW(idx).location(i ,:) = location_estimated(i,:);
RadarPDW(idx).erro(i ,:) = erro(i);
end
end
%% 存入文件
% 指定保存MAT文件的路径和文件名
filename = 'C:\Users\86182\MATLAB_code\project0102\RadarPDW_located.mat';
% 保存变量到MAT文件
save(filename, 'RadarPDW');
% %% 画图
% figure
% axesm('MapProjection','ortho','Frame','on',...
% 'grid','on','Origin',[20,50,0],...
% 'MLineLimit',[-75 75],...
% 'MLineException',[-90,0,90,180]);
% load coastlines;
% plotm(coastlat,coastlon);
% hold on
% % scatterm(x_end_lla(1,:),x_end_lla(2,:),15,'filled','ro');
% % scatterm(10,115,10,'filled','bo');
% geoshow(x_end_lla(1,:),x_end_lla(2,:),'Marker','.','MarkerEdgeColor','red','MarkerSize',15);%标记辐射源解算位置
% geoshow(latitude,longitude,'Marker','.','MarkerEdgeColor','blue','MarkerSize',10);%标记辐射源实际位置
% legend('地球轮廓','边界线','定位位置','辐射源位置');
% text(1.05, -1, ['定位位置:-31.9973°,80.0214°,0.0000m'], 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top');
% text(1.05, -1.1, ['辐射源位置:-32°,80°,0m'], 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top');