【问题标题】:Polar(3D) plot with theta, phi and radius具有 theta、phi 和半径的 Polar(3D) 图
【发布时间】:2019-03-06 19:51:33
【问题描述】:

我想用极坐标参数 theta、phi 和半径绘制一个 3D 图。我已经计算了这 3 个参数,但我无法获得 3D 图。

我想要一个如下图所示的情节。

我从 matlab 中的 PhaseShiftBeamformerUsingULAExample 得到这个图。我不明白他们是如何得到这样的阴谋的。 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')

【问题讨论】:

    标签: matlab 3d polar-coordinates


    【解决方案1】:

    示例代码使用the pattern command from the phased array toolbox。这对于他们的应用来说是非常具体的。

    我只需将 theta、phi 和 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)
    

    当然也可以偷懒使用 sph2cart(请注意,Matlab 的角度符号与我相反):

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

    【讨论】:

    • 如何在这个图中显示角度?没有办法获得与我使用模式命令获得的相同的情节吗? @AndersSandberg
    • pattern 命令似乎做了很多额外的修饰,大概是使用普通的绘图命令。你到底想展示什么?
    • 我正在做与示例代码相同的事情,我只是不想在我的实现中使用库函数。 @AndersSandberg
    猜你喜欢
    • 1970-01-01
    • 2015-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-11
    • 1970-01-01
    相关资源
    最近更新 更多