admin 发表于 2023-9-6 06:38:50

无源探测交汇定位Matlab仿真

【代码名称】:无源探测交汇定位Matlab仿真

【代码介绍】:无源探测交汇定位Matlab仿真

【代码截图】:clear;
clc;
close all;


% a = 45;
% b = 45;
% r = (b-a).*rand(1,1) + a;
% dis = 25e3;         %100km
tar_loc = ';
targetloc = [ tar_loc(2)*sind( tar_loc(1) );tar_loc(2)*cosd( tar_loc(1) ) ]; % 目标x-y坐标位置

T = 60*5;
v = 100/3.6;
thetaAir = tar_loc(1) + 45;      % 飞机航向,单位°acosd(10/25)
deltaT = 1;      % 每deltaT秒计算一个角度和距离
% initial_coor = 1000*rand(1,2);
initial_coor = ;

rangeAir = v*deltaT:v*deltaT:v*T;    % 飞行位置向量
radarloc_x = rangeAir*sind(thetaAir);   % 无人机航向X轴坐标
radarloc_y = rangeAir*cosd(thetaAir);   % 无人机航向Y轴坐标
radarloc = ;   % 无人机x-y坐标位置,单位km
sigma = 1;


figure(1);hold on;
plot(0,0,'xr','LineWidth',2);
plot(targetloc(1),targetloc(2),'pr','LineWidth',2);
plot(radarloc(1,:),radarloc(2,:),'-.b','LineWidth',0.5);


Ax = [];
Ay = [];
Ae = [];


for i = 1:T
    x1 = initial_coor(1);
    y1 = initial_coor(2);
    x2 = radarloc_x(i);
    y2 = radarloc_y(i);

    theta1 = atand((x2 -initial_coor(1))/(y2-initial_coor(2))) - tar_loc(1);
    theta2 = thetaAir - atand( ( x2 - targetloc(1) )./(y2- targetloc(2) ) );
    theta2 = theta2 + sigma*randn(1,1);

    theta2 = smooth(theta2,500,'rloess');



    x = (x2.*tand(theta2) - x1.*tand(theta1) + y1 - y2)./(tand(theta2)-tand(theta1));
    y = (y1.*tand(theta2) - y2.*tand(theta1) + tand(theta1).*tand(theta2).*(x2-x1))./(tand(theta2)-tand(theta1));



    Ax = ;
    Ay = ;
    xx = ';

    error = dist_E(xx,targetloc');
    error
    error = error./tar_loc(2)*100;

    error

    Ae = ;



end
figure(2);
plot(Ae);
title('误差变化');xlabel('时刻');ylabel('误差变化值');
axis();
% ylim();%确定Y轴的范围是-1到3
set(gca,'YTick',); %改变y轴坐标间隔显示 这里间隔为2


figure(3);
subplot(2,1,1);
plot(Ax);hold on;
plot(,,'r' ,'linewidth',2);
plot(,,'b' ,'linewidth',1);
plot(,,'b' ,'linewidth',1);
title('x坐标变化');xlabel('时刻');ylabel('x坐标值');
axis();
subplot(2,1,2);
plot(Ay);hold on;
plot(,,'r' ,'linewidth',2);
plot(,,'b' ,'linewidth',1);
plot(,,'b' ,'linewidth',1);
title('y坐标变化');xlabel('时刻');ylabel('y坐标值');
axis();



function dist = dist_E(x,y)
dist = ;
dist = pdist(dist); % 计算各行向量之间的欧式距离
end



【代码下载】:
页: [1]
查看完整版本: 无源探测交汇定位Matlab仿真