Problem In Generating Proper Contour Plot from Radiation Pattern

2 views (last 30 days)
I am Implementing following equation which describes the focal region field of reflector antenna.the code for this is as below
% % This program is developed by Balvant Makwana % % which explains the electric field distribution in focal region field
clc; close all; clear all;
u= linspace(-10,10,2000); % distance from focus right now it is not normalised
to=4;
% theta= input('enter the value of theta in degree (in practice theta do not exeed 50) ');
% phi= input('enter the vaue of Phi in degrees (90) ');
theta=40;
phi=90;
J1 = besselj(1,u);
J2 = besselj(2,u);
Ex=2*(J1./u)+1i*[(4/to)*tan(theta/2).*(J2./u)*cos(phi)];
Ey=-1i*(4/to)*tan(theta/2).*(J2./u)*sin(phi);
Ez=-1i*(4/to)*(J2./u)*sin(phi);
Ex_log =20*log(Ex);
Ey_log=20*log(Ey);
Ez_log=20*log(Ez);
figure(1);
plot(u,Ex_log);
hold on;
plot(u,Ey_log,'-r');
%figure(2);
plot(u,Ez_log);
xlabel('distance from Focus');
title('Electric Field Distribution of Reflector');
hold off;
%for contour plot abs_Ex_log=abs(Ex_log); abs_Ey_log=abs(Ey_log); lx=abs_Ex_log; ly=abs_Ey_log;
% % lx=Ex_log; % % ly=Ey_log;
% z=repmat(abs_Ex_log,size(u));
% xv = abs_Ex_log .* cos(theta); % // 2D Cartesian coordinates % yv = abs_Ex_log .* sin(theta); % // 2D Cartesian coordinates % % % % % phi = -pi:.01:pi; % // 3D revolution angle around theta = 0 % % % % % // 3D points of the surface % xf = repmat(xv',size(u)); % yf = yv' * cos(phi); % zf = yv' * sin(phi); % [x,y] = meshgrid(xf,yf); % % mesh(xf,yf,zf)
[X,Y]= meshgrid(u,u); Zx= lx'*lx; Zy=ly'*ly;
% figure(2) % surfc(X,Y,Zx) % colormap hsv
figure(3);
csx=contour(X,Y,Zx,20);
hold on;
csy=contour(X,Y,Zy,20);
i am getting the required plot(pattern) but contour plot is not proper. i am getting contour plot as shown
the actual contour plot should be as below
someone please do correction in code i have tried lot but couldn't rectify the problem

Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!