2013-01-05 176 views
3

天线辐射的特点,我需要绘制该功能enter image description here绘制在MATLAB

theta = (-pi:0.01:pi); 
f = 3*10^9; 
c = 299792458; 
da = 2; 

这里是我的代码,但我不知道它是正确的。我不知道应该在哪里。如何设置X轴为递减?

beta = (2*pi*f)/c; 
const= (da*beta)/2; 
j= (cos(theta)+1).*(besselj(1,const*sin(theta))./(const*sin(theta))); 

我的另一个问题是如何在极坐标中绘制该函数。

我做了这样的事情。

polar(theta,j); 

是否可以旋转该函数(通过y轴)来获得3D图?

回答

1

事情对我来说很合适,但我不会使用符号j作为变量,因为(如i那样)它是虚构单元的符号(sqrt(-1))。这样做是为了覆盖它,因此事情将起作用,直到你不需要复杂的数字为止。

如果您的目标是按照元素组合数组条目,则应该使用基于元素的操作,例如(.*),正如您正确获取F(\theta)一样。实际上,cos(theta)是包含在theta等中的角度的余弦阵列。

最后,您可以使用命令Rotate 3D在绘图窗口中旋转绘图。尽管如此,你有一条二维曲线(F(\theta)),因此,你将继续旋转一个二维图形获得某种的透视图它,只不过是。要获得真正的信息,你需要一个额外的因变量(或者我误解了你的问题?)。 enter image description here

编辑:现在我明白你的意思,你希望周围的一些线,我想凭借对称Surface of revolution其中是theta=0。那么,旋转表面可以通过一些解析几何图形来获得,并绘制成例如通过使用mesh。检查了这一点:

% // 2D polar coordinate radius (your j) 
    Rad= (cos(theta)+1).*(besselj(1,const*sin(theta))./(const*sin(theta))); 
    Rad = abs(Rad); % // We need its absolute value for sake of clarity 


    xv = Rad .* cos(theta); % // 2D Cartesian coordinates 
    yv = Rad .* sin(theta); % // 2D Cartesian coordinates 

    phi = -pi:.01:pi;  % // 3D revolution angle around theta = 0 

    % // 3D points of the surface 
    xf = repmat(xv',size(phi)); 
    yf = yv' * cos(phi); 
    zf = yv' * sin(phi); 

    mesh(xf,yf,zf) 

enter image description here

您还可以通过

mesh(xf,yf,zf,'FaceColor','interp','FaceLighting','phong') 
camlight right 

和更细的角度离散(1e-3)添加图形效果

enter image description here

做到这一点。

+0

我想得到像这样的东西http://imageshack.us/photo/my-images/818/3dplot.png/ – daredesm

+1

@daredesm,我明白了你的观点,围绕哪一轴想要革命完成? 'theta = 0'? – Acorbe

+1

@daredesm,请检查更新的答案。 – Acorbe