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);
%%
%road_x=[road_x -5:0.5:5];
refline_y=(0:0.5:10);
refline_x=-3*ones(size(refline_y));
refline_z=zeros(size(refline_y));
road_x=(-5:0.5:5);
road_y=3*ones(size(road_x));
road_z=zeros(size(road_x));
%road_y=[road_y zeros(1,21)+3];
%road_z=[];
%road_z=[road_z (zeros(1,21))];
%%
radio_tower_z=0.2:.01:.5; %extends 300m up from base at 200m elevation
radio_tower_x=1.5*ones(size(radio_tower_z));
radio_tower_y=5.0*ones(size(radio_tower_z));
%radio_tower_x=[];
%radio_tower_x=[radio_tower_x (zeros(1,31)+1.5)];
%radio_tower_y=[];
%radio_tower_y=[radio_tower_y (zeros(1,31)+5)];
%radio_tower_z=[];
%radio_tower_z=[radio_tower_z 0.2:0.01:0.5];
%%
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
Radar_x = 0.0;
Radar_y = 0.0;
Radar_z = 2.0;
[box_Az,box_Rng] = FN_PPI_SR(box_x,box_y,box_z,Radar_x,Radar_y,Radar_z);
[refline_Az,refline_Rng] = FN_PPI_SR(refline_x,refline_y,refline_z,Radar_x,Radar_y,Radar_z);
[road_Az,road_Rng] = FN_PPI_SR(road_x,road_y,road_z,Radar_x,Radar_y,Radar_z);
[ridgebasef_Az, ridgebasef_Rng] = FN_PPI_SR(ridgebasef_x,ridgebasef_y,ridgebasef_z,Radar_x,Radar_y,Radar_z);
[tower_Az,tower_Rng] = FN_PPI_SR(radio_tower_x,radio_tower_y,radio_tower_z,Radar_x,Radar_y,Radar_z);
[ridgetop_Az,ridgetop_Rng] = FN_PPI_SR(ridgetop_x,ridgetop_y,ridgetop_z,Radar_x,Radar_y,Radar_z);
[ridgebaseb_Az,ridgebaseb_Rng] = FN_PPI_SR(ridgebaseb_x,ridgebaseb_y,ridgebaseb_z,Radar_x,Radar_y,Radar_z);
figure(3)
polarplot(box_Az,box_Rng,'k');hold on; %'k' gives black
polarplot(road_Az,road_Rng,'b');
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)');
%legend('FRAME','ROAD','RIDGEBASE-F','TOWER','RIDGETOP','RIDGEBASE-B');
legend('ROAD','RIDGEBASE-F','TOWER','RIDGETOP','RIDGEBASE-B');
% 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
%Inputs: tx,ty,tz,rx,ry,rz (t=target, r=radar)
%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