# Radar System PPI polar display

9 vues (au cours des 30 derniers jours)
Jose Iglesias le 17 Mar 2022
I am trying to shift my current PPI slant range plot to align towards the right side of the polar plot. I am including the code which will give you a nice plot where the center of the top of the scene diagram is aligned at 90 degrees theta. I am trying to move my scene diagram towards the right of polar plot as seen in the second attached pic entitled "stuff 2".. Any suggestions? This is supposed to mimic a PPI dispaly 1.8km from a radar(or 200m) above ground. Thanking you in advance. By the way, I think my first plot is correct because my rho calculatiuons match Matlabs R points. Here is the current code.
% 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];
% rho = [9.72 8.69 4.36 3.59 9.15 8.41 7.37 3.59 2.67 8.83 7.89 7.13 6.07 2.89 1.81 8.40 4.52 3.72 2.67 1.81 0.2 4.08 9.56 6.26 5.7 4.91 4.36 3.59];
%% build scenario
box_x=[];
box_x=[box_x -5:0.5:5];
box_x=[box_x (zeros(1,21)+5)];
box_x=[box_x 5:-0.5:-5];
box_x=[box_x (zeros(1,21)-5)];
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.50:0];
box_z=zeros(1,84);
%%
refline_y=(0:0.5:10);
refline_x=-3*ones(size(refline_y));
refline_z=zeros(size(refline_y));
%%
radio_tower_z=0.2:.01:.5; %extends 300m up from base at 200m elevation
%%
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))];
%%
ridgetop_x=-5:.5:5;
ridgetop_y=[10:-.5:5,5*ones(1,10)];
ridgetop_z=0.2*ones(size(ridgetop_x));
%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.20:-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))];
% done with Scenario
%% Call conversion to PPI_SR
figure(3)
polarplot(box_Az,box_Rng,'k');hold on; %'k' gives black
hold on; %'b' gives blue
polarplot(refline_Az,refline_Rng,'m'); %'m' gives magenta
polarplot(ridgebasef_Az,ridgebasef_Rng,'.-g');%'.-g' gives dashed green line
polarplot(tower_Az,tower_Rng,'rx'); %'g' gives red line
polarplot(ridgetop_Az,ridgetop_Rng,'.-c'); %'.-c' gives dashed cyan line
polarplot(ridgebaseb_Az,ridgebaseb_Rng,'y');%'y' gives yellow line
hold off;
thetalim([0,360])
rlim([0 12]);
grid on
%xlabel('AZIMUTH (deg)')
%ylabel('SLANT RANGE (km)')
title('PPI (SLANT RANGE)');
% 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 [outaz,outR] = FN_PPI_SR(tx,ty,tz,rx,ry,rz)
%FN_PPI_SR Return vectors of azmuth and range
%Outputs: outaz, outR
%outR = sqrt((tx-rx).^2+(ty-ry).^2+(tz-rz).^2)-(tz-0.2);
outR = sqrt((tx-rx).^2+(ty-ry).^2+(tz-rz).^2)-(rz-0.2);
% x^2 y^2 (H-h)^2
%outaz = 57.3*atan((tx-rx)./(ty-ry));
outaz = atan2(ty-ry,tx-rx);
end
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

Vinayak le 9 Fév 2024
Hi Jose,
It seems you're working on a MATLAB project involving the plotting of PPI (Plan Position Indicator) slant range data and aiming to shift the scene diagram towards the right side of the polar plot. I've reviewed your code and you may make the following adjustments to your code:
1. Introduce an offset angle variable (`offset_angle`) to determine the amount of shift.
2. Modify the azimuth angles of the scene objects by adding this offset angle and ensuring the values remain within the range of 0 to 360 degrees using the `mod()` function.
3. Plot the shifted scene diagram using the modified azimuth angles.
Here's the modified code snippet:
% Define the offset angle
offset_angle = 90; % Shift the scene diagram by 90 degrees to the right
box_Az_shifted = mod(box_Az + offset_angle, 360);
% Similar adjustments for other scene objects...
% Plot the shifted scene diagram
figure(3)
% Plot other scene objects...
% Set plot properties
thetalim([0, 360])
rlim([0 12]);
grid on
title('PPI (SLANT RANGE)');
By implementing these modifications, the scene diagram should now appear shifted towards the right side of the polar plot, as desired.
For further reading and understanding of MATLAB functions used in the solution, you can refer to the MATLAB documentation:
I hope this helps!
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Polar Plots 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