Полярный (3D) график с тэтой, фи и радиусом - PullRequest
0 голосов
/ 06 марта 2019

Я хочу построить трехмерный график с полярными параметрами тэта, фи и радиус. Я рассчитал эти 3 параметра, но не смог получить 3D-график.

Мне нужен график, который будет выглядеть как на рисунке ниже. enter image description here

Я получил этот график из PhaseShiftBeamformerUsingULAExample в matlab. Я не понимаю, как они получили такой заговор. Код Matlab для него ниже.

%% Phase-Shift Beamformer Using ULA
% Apply phase-shift beamforming to the signal received by a 5-element ULA.
% The beamforming direction is 45° azimuth and 0° elevation. Assume
% the array operates at 300 MHz. Specify the beamforming direction using an
% input port.

%%
% Simulate a sinewave signal arriving at the array.
clearvars;close all;
t = (0:1000)';
fsignal = 0.01;
x = sin(2*pi*fsignal*t);
c = physconst('LightSpeed');
fc = 300e6;
incidentAngle = [30;15];


array = phased.ULA('NumElements',5);
x = collectPlaneWave(array,x,incidentAngle,fc,c);
noise = 0.1*(randn(size(x)) + 1j*randn(size(x)));
rx = x + noise;

%%
% Construct the phase-shift beamformer and then beamform the input data.
beamformer = phased.PhaseShiftBeamformer('SensorArray',array,...
    'OperatingFrequency',fc,'PropagationSpeed',c,...
    'DirectionSource','Input port','WeightsOutputPort',true);
%%
% Obtain the beamformed signal and the beamformer weights.
[y,w] = beamformer(rx,incidentAngle);
%%
% Plot the original signal at the middle element and the beamformed signal.
figure();
plot(t,real(rx(:,3)),'r:',t,real(y))
xlabel('Time')
ylabel('Amplitude')
legend('Original','Beamformed')

%%
% Plot the array response pattern after applying the weights.
figure();
pattern(array,fc,[-180:180],            [-90:90],'PropagationSpeed',c,'CoordinateSystem','polar','Weights',w,'Type','efi    eld')

1 Ответ

0 голосов
/ 07 марта 2019

В примере кода используется команда шаблона из набора инструментов фазированного массива . Это довольно специфично для их применения.

Я бы просто взял тэта, фи и r и преобразовал их в декартовы координаты и построил их используя surf или surfl:

[theta,phi]=meshgrid(linspace(-pi/2,pi/2),linspace(0,2*pi));
r=1+sin(theta*3).*cos(phi*2);
X=cos(theta).*cos(phi).*r;
Y=cos(theta).*sin(phi).*r;
Z=sin(theta).*r;
surf(X,Y,Z)

enter image description here

Можно, конечно, также быть ленивым и использовать sph2cart (обратите внимание, что Matlab имеет противоположное обозначение углов от меня):

[X,Y,Z] = sph2cart(phi,theta,r);
...