# Radar System slant range display

4 vues (au cours des 30 derniers jours)
Jose Iglesias le 20 Mar 2022
I am trying to add a 10 degree yaw angle to my code to a create a new x' and y' coordinate. This is a matrix rotation. My current code which I present here is for a SLAR slant range radar display that creates a beautiful plot that shows a gridded terrain that also has an elevation of 300m and a depression of 100m. The yaw angle coordinates are as follows:
Doing the matrix math gives you:
x' = 0.985x + 0.174y
y' = -0.174x + 0.985y
The actual gridded terrain ranges from -3km to 3km on the x-axis and the y-axis ranges from 0 to 10km. I attached a pic of the SLAR slant range plot with the current code. I also attached a second pic of how the plot will look like once the 10 degree yaw angle is implemented. The last attachment is a pic of the coordinate system with the new x' and y' coordinates.
My question is, how do I create the x' and y' coordiantes and integrate it into my current code which is shown below? What I am thinking of doing is adding the following code:
c = [box_x line1_x line2_x line3_x line4_x highel_x depr_x refline1_x refline2_x];
d = [box_y line1_y line2_y line3_y line4_y highel_y depr_y refline1_y refline2_y];
plot(c,d);
hold on;
a = (10*pi/180);
z = [cos(a) sin(a);-sin(a) cos(a)];
m = [c;d];
k = z*m;
r = k(1,:);
s = k(2,:);
plot(r,s);
Here is the current code shown below. Please show me how to add a yaw angle of 10 degrees to the code below.
clear all
% x = [5 5 5 5 4 4 4 4 4 3 3 3 3 3 3 0 0 0 0 0 0 1.5 5 5 5 5 5 5];
% y = [10 9 3 0 10 9 8 3 0 10 9 8 7 3 0 10 6 5 4 3 0 5 10 6 5 4 3 0];
% h = [1.8 2 2 2 2 1.8 2 2 2 2 2 1.8 2 2 2 2 2 1.8 2 2 2 1.8 2 2 1.8 2 2 2];
% phi = [-26.6 -29.1 -59.1 -90 -21.8 -24.0 -26.6 -53.1 -90 -16.7 -18.4 -20.6 -23.2 -45 -90 0 0 0 0 0 0 21.8 26.6 39.8 45 51.3 59.0 90];
% r = [11.32 10.49 6.16 5.39 10.95 10.01 9.17 5.39 4.47 10.63 9.70 8.73 7.87 4.69 3.61 10.20 6.32 5.32 4.47 3.61 2 5.59 11.36 8.06 7.30 6.71 6.16 5.39];
%% build scenario
box_x=[];
box_x=[box_x -3:0.3:3];
box_x=[box_x (zeros(1,21)+3)];
box_x=[box_x 3:-0.3:-3];
box_x=[box_x (zeros(1,21)-3)];
box_y=[];
box_y=[box_y zeros(1,21)];
box_y=[box_y 0:0.5:10];
box_y=[box_y (zeros(1,21)+10)];
box_y=[box_y 10:-0.5:0];
box_z=zeros(1,84);
%%
line1_x=[];
line1_x=[line1_x -3:0.3:3];
line1_y=[];
line1_y=[line1_y zeros(1,21)+2];
line1_z=[];
line1_z=[line1_z (zeros(1,21))];
%%
line2_x=[];
line2_x=[line2_x -3:0.3:3];
line2_y=[];
line2_y=[line2_y zeros(1,21)+4];
line2_z=[];
line2_z=[line2_z (zeros(1,21))];
%%
line3_x=[];
line3_x=[line3_x -3:0.3:3];
line3_y=[];
line3_y=[line3_y zeros(1,21)+6];
line3_z=[];
line3_z=[line3_z (zeros(1,21))];
% ridgebasef_x=[];
% ridgebasef_x=[ridgebasef_x 5:-0.25:0];
% ridgebasef_x=[ridgebasef_x 0:-0.25:-5];
% ridgebasef_y=[];
% ridgebasef_y=[ridgebasef_y (zeros(1,21)+4)];
% ridgebasef_y=[ridgebasef_y 4:0.25:9];
% ridgebasef_z=[];
% ridgebasef_z=[ridgebasef_z (zeros(1,42))];
%%
line4_x=[];
line4_x=[line4_x -3:0.3:3];
line4_y=[];
line4_y=[line4_y zeros(1,21)+8];
line4_z=[];
line4_z=[line4_z (zeros(1,21))];
% amg_x=[];
% amg_x=[amg_x 3:-0.2:-1];
% amg_x=[amg_x -1:-0.2:3];
% amg_y=[];
% amg_y=[amg_y (zeros(1,21)+6)];
% amg_y=[amg_y 6:0.1:8];
% amg_z=[];
% amg_z=[amg_z (zeros(1,42)+0.8)];
% ridgetop_x=[];
% ridgetop_x=[ridgetop_x 5:-0.25:0];
% ridgetop_x=[ridgetop_x 0:-0.25:-5];
% ridgetop_y=[];
% ridgetop_y=[ridgetop_y (zeros(1,21)+5)];
% ridgetop_y=[ridgetop_y 5:0.25:10];
% ridgetop_z=[];
% ridgetop_z=[ridgetop_z (zeros(1,42)+0.2)];
% ridgebaseb_x=[];
% ridgebaseb_x=[ridgebaseb_x 5:-0.25:0];
% ridgebaseb_x=[ridgebaseb_x 0:-0.2:-4];
% ridgebaseb_y=[];
% ridgebaseb_y=[ridgebaseb_y (zeros(1,21)+6)];
% ridgebaseb_y=[ridgebaseb_y 6:0.20:10];
% ridgebaseb_z=[];
% ridgebaseb_z=[ridgebaseb_z (zeros(1,42))];
refline1_y=(0:0.5:10);
refline1_x=-1*ones(size(refline1_y));
refline1_z=zeros(size(refline1_y));
refline2_y=(0:0.5:10);
refline2_x=1*ones(size(refline2_y));
refline2_z=zeros(size(refline2_y));
%% build grid points
grid_xvalues=-1:0.1:1;
grid_yvalues=-1:0.1:1;
grid_yvalues=grid_yvalues(:);
for ii=1:length(grid_xvalues)
grid_template_x(ii,:)=grid_xvalues;
grid_template_y(:,ii)=grid_yvalues;
end
grid_template_z(1:length(grid_xvalues),1:length(grid_xvalues))=zeros;
grid_template_x=reshape(grid_template_x,1,[]);
grid_template_y=reshape(grid_template_y,1,[]);
grid_template_z=reshape(grid_template_z,1,[]);
%% high elevation data
highel_x=[];
highel_y=[];
highel_z=[];
highel_x=[highel_x grid_template_x+0];
highel_y=[highel_y grid_template_y+7];
highel_z=[highel_z grid_template_z+0.3];
highel_x=[highel_x grid_template_x+2];
highel_y=[highel_y grid_template_y+7];
highel_z=[highel_z grid_template_z+0.3];
depr_x=[];
depr_y=[];
depr_z=[];
depr_x=[depr_x grid_template_x+2];
depr_y=[depr_y grid_template_y+5];
depr_z=[depr_z grid_template_z-0.1];
% done with Scenario
%% Call conversion to SLAR_SR
figure(5)
plot(box_Az,box_Rng,'k');hold on; %'k' gives black
plot(line1_Az,line1_Rng,'b');%'b' gives blue
plot(line2_Az,line2_Rng,'y');%'y' gives green
plot(line3_Az,line3_Rng,'r');%'r' gives red
plot(line4_Az,line4_Rng,'c');%'r' gives cyan
%plot(ridgebasef_Az,ridgebasef_Rng,'.-g');%'.-g' gives dashed green line
%plot(amg_Az,amg_Rng,'black');%'k' gives black line
plot(refline1_Az,refline1_Rng,'r');%'g' gives red line
plot(refline2_Az,refline2_Rng,'b');%'g' gives blue line
%plot(tower_Az,tower_Rng,'r');%'g' gives red line
plot(highel_Az,highel_Rng,'.g');%'g' gives red line
plot(depr_Az,depr_Rng,'.m');%'m' gives magenta line
%plot(ridgetop_Az,ridgetop_Rng,'.-c');%'.-c' gives dashed cyan line
%plot(ridgebaseb_Az,ridgebaseb_Rng,'y');%'y' gives yellow line
hold off;
xlim([-4 4])
ylim([4 12]);
grid on
xlabel('ALONG-TRACK DISTANCE (km)')
ylabel('SLANT RANGE (km)')
title('SLAR (SLANT RANGE)');
%legend('FRAME','LINE1','LINE2','LINE3','LINE4','REFLINE1','REFLINE','ABOVE GROUND','BELOW GROUND');
% figure
% hold on
% plot(box_x,box_y,x,y)
% set(gca,'XTickLabel', [-90 -70 -50 -30 -10 0 10 30 50 70 90])
% set(gca, 'YTickLabel', [0 1 2 3 4 5 6 7 8 9 10])
%%
function [outCROSSRANGE outR] = FN_SLAR_SR(tx,ty,tz,rx,ry,rz)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
outR = sqrt((ty-ry).^2+(tz-rz).^2);
% y^2 (H-h)^2
outCROSSRANGE = (tx-rx);
end
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

Pratik le 12 Fév 2024
Hi Jose,
To add a yaw angle of 10 degrees to your existing code, rotation matrix must be applied to set of coordinates before plotting them. The outlined rotation matrix is correct for a 10-degree yaw angle. Please refer to the following steps to integrate it to your code:
1. Define the rotation matrix with the 10-degree yaw angle.
2. Apply the rotation to each set of coordinates (box, lines, high elevation, depression, reference lines, etc.).
3. Plot the rotated coordinates.
Please refer to the code snippet below on how to make the rotation matrix and function to apply rotation:
%% Define the rotation matrix for a 10-degree yaw angle
%% Apply the rotation to the scenario coordinates
% Function to apply rotation to a set of x and y coordinates
function [rotated_x, rotated_y] = apply_rotation(x, y, rotation_matrix)
original_coords = [x; y];
rotated_coords = rotation_matrix * original_coords;
rotated_x = rotated_coords(1, :);
rotated_y = rotated_coords(2, :);
end
This function can be used to apply the rotation to any set of x and y coordinates in scenario. Please refer to the snippet below for an example on how to apply the rotation on box:
% Apply rotation to box
[box_x_rotated, box_y_rotated] = apply_rotation(box_x, box_y, rotation_matrix);
I hope this helps!
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Data Synthesis dans Help Center et File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by