Create a matrix for a radar plane movement

2 visualizaciones (últimos 30 días)
Miguel Albuquerque
Miguel Albuquerque el 11 de Mayo de 2022
Respondida: Vatsal el 30 de En. de 2024
hey to all, thanks for reading this in advance.
I have a AoI=200 x 200 binary matrix, composed by zeros and ones(0 and 1), I define the position of the 1.
The 1 in the matrix represent isolated targets in a radar scenario, for example,AoI(2,(5:10)) = 1.
I define also the position of a receiving antenna (x_receiver=400,y=receiver=400) and of a aeroplane,which has a transmitter on board and this plane is moving in x axis,and stops along the path to iluminate this AoI scenario. The movement of the plane is defined by waypoints
x_transmitter=200
y_transmitter=waypoints=[10,20,30,40]
In my code I have a main cycle that read this matrix, identifies the targets and calculates several radar parameters: My doubt is: that for each waypoint I produce a series of calculations. And Imagine at waypoint 10, target(2,5),(2,6),(2,7) get founded. I calculate Reference_SignalFD and Surveillance_SignalFD. But if at waypoint 20, target(2,8),(2,9) gets founded I want to also calculate Reference_SignalFD and Surveillance_SignalFD but without eliminating the calculations of previous waypoint. so basically I want that in all plane movement Reference_SignalFD and Surveillance_SignalFD gets calculated in a matrix where the lines of that matrix are the different waypoints and the columns are the values of the calculations. Thanks
for i=1:numel(waypoints)
Y_transmitter = waypoints(i);
for xx=1:200
for yy=1:200
if AoI(xx,yy) ~= 0 % Target detection
X_target= xx;
Y_target= yy;
VTransmitter_target=[X_target-X_transmitter Y_target-Y_transmitter]; % Vector transmitter-target
Vectors_product=dot( VTransmitter_target,normal_ntarget1)/norm(VTransmitter_target);
angle_transmitter =180-acosd(Vectors_product);
VTarget_receiver=[X_receiver-X_target Y_receiver-Y_target]; % Vector Target-receiver
Vectors_product=dot( VTarget_receiver,normal_ntarget1)/norm(VTarget_receiver);
angle_receiver =acosd(Vectors_product);
status=snell_function(angle_transmitter,angle_receiver,teta_flutuations);
Pr = LoS_receiver(X_receiver,Y_receiver,X_target,Y_target,AoI);
Pt = LoS_transmitter(X_transmitter,Y_transmitter,X_target,Y_target,AoI);
if status ==1 & Pt ==1 & Pr ==1
R1=sqrt( (X_transmitter-X_target).^2 + (Y_transmitter-Y_target).^2); % Distance transmitter-target in meters
R2=sqrt( (X_receiver-X_target).^2 + (Y_receiver-Y_target).^2); % Distance Receiver-target in meters
Rd=sqrt( (X_receiverref-X_transmitter).^2 + (Y_receiverref-Y_transmitter).^2); % Distance Transmitter-Receiver in meters
k0=(2*pi*freq_XQPSK)/c; % Wave index variable in radians
Surveillance_SignalFD=(1/(R1+R2))*X_QPSK.*exp(-1*j*k0*(R1+R2)); % Surveillance Signal frequency domain
Reference_SignalFD=(1/Rd)*X_QPSK.*exp(-1*j*k0*Rd); % Reference Signal frequency domain
fprintf('\n Coordenadas do avião(%d,%d)',X_transmitter,Y_transmitter);
fprintf('\n Coordenadas do alvo(%d,%d)',X_target,Y_target);
fprintf('\n Distância transmissor-alvo R1 %4.2f metros',R1);
fprintf('\n Distância alvo-recetor R2 %4.2f metros',R2);
fprintf('\n Distância transmissor-recetor Rd %4.2f metros',Rd);
continue
end
end
end
end
end
  2 comentarios
Catalytic
Catalytic el 11 de Mayo de 2022
Editada: Catalytic el 11 de Mayo de 2022
I see you are not new to the Answers forum. You should therefore be getting into the habit of formating your code,
demonstrating it with the RUN function,
and explaining, not just the bottomline thing you want, but also what is deficient about your current code.
Miguel Albuquerque
Miguel Albuquerque el 11 de Mayo de 2022
Okay, next time I will have this considered, but can you help me?

Iniciar sesión para comentar.

Respuestas (1)

Vatsal
Vatsal el 30 de En. de 2024
Hi,
It seems like you want to store the “Reference_SignalFD” and “Surveillance_SignalFD” for each waypoint in a matrix. This can be achieved by initializing a matrix before the loop begins and then populating it with the corresponding results at each waypoint.
Below is a suggested modification to the provided code:
% Initialize matrices to store Reference_SignalFD and Surveillance_SignalFD
Reference_SignalFD_Matrix = zeros(numel(waypoints), 200, 200);
Surveillance_SignalFD_Matrix = zeros(numel(waypoints), 200, 200);
for i=1:numel(waypoints)
Y_transmitter = waypoints(i);
for xx=1:200
for yy=1:200
if AoI(xx,yy) ~= 0 % Target detection
X_target= xx;
Y_target= yy;
VTransmitter_target=[X_target-X_transmitter Y_target-Y_transmitter]; % Vector transmitter-target
Vectors_product=dot( VTransmitter_target,normal_ntarget1)/norm(VTransmitter_target);
angle_transmitter =180-acosd(Vectors_product);
VTarget_receiver=[X_receiver-X_target Y_receiver-Y_target]; % Vector Target-receiver
Vectors_product=dot( VTarget_receiver,normal_ntarget1)/norm(VTarget_receiver);
angle_receiver =acosd(Vectors_product);
status=snell_function(angle_transmitter,angle_receiver,teta_flutuations);
Pr = LoS_receiver(X_receiver,Y_receiver,X_target,Y_target,AoI);
Pt = LoS_transmitter(X_transmitter,Y_transmitter,X_target,Y_target,AoI);
if status ==1 & Pt ==1 & Pr ==1
R1=sqrt( (X_transmitter-X_target).^2 + (Y_transmitter-Y_target).^2); % Distance transmitter-target in meters
R2=sqrt( (X_receiver-X_target).^2 + (Y_receiver-Y_target).^2); % Distance Receiver-target in meters
Rd=sqrt( (X_receiverref-X_transmitter).^2 + (Y_receiverref-Y_transmitter).^2); % Distance Transmitter-Receiver in meters
k0=(2*pi*freq_XQPSK)/c; % Wave index variable in radians
Surveillance_SignalFD=(1/(R1+R2))*X_QPSK.*exp(-1*j*k0*(R1+R2)); % Surveillance Signal frequency domain
Reference_SignalFD=(1/Rd)*X_QPSK.*exp(-1*j*k0*Rd); % Reference Signal frequency domain
Reference_SignalFD_Matrix(i, xx, yy) = Reference_SignalFD;
Surveillance_SignalFD_Matrix(i, xx, yy) = Surveillance_SignalFD;
fprintf('\n Coordenadas do avião(%d,%d)',X_transmitter,Y_transmitter);
fprintf('\n Coordenadas do alvo(%d,%d)',X_target,Y_target);
fprintf('\n Distância transmissor-alvo R1 %4.2f metros',R1);
fprintf('\n Distância alvo-recetor R2 %4.2f metros',R2);
fprintf('\n Distância transmissor-recetor Rd %4.2f metros',Rd);
continue
end
end
end
end
end
I hope this helps!

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by