how can i plot radiation pattern in cartesian coordinate in matlab ?
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
0 votes
Accepted Answer
sixwwwwww
on 13 Oct 2013
Dear Naveedp, here is the code you can use for plotting:
theta = -90:90;
theta_rad = degtorad(theta);
r = 1;
elevation = 0;
[x,y,z] = sph2cart(theta_rad,elevation,r);
E_theta = 1j * 30 * exp(-1j * 2 * pi) * sin(5 * pi * sin(theta)) ./ (5 * pi * sin(theta));
E_phi = 1j * 30 * exp(-1j * 2 * pi) * cos(theta) .* sin(3 * pi * sin(theta)) ./ (3 * pi * sin(theta));
figure, subplot(2,1,1), plot3(x, y, abs(E_theta)), xlabel('x'), ylabel('y'), zlabel('z'), title('E(theta) amplitude')
subplot(2,1,2), plot3(x, y, angle(E_theta)), xlabel('x'), ylabel('y'), zlabel('z'), title('E(theta) phase')
figure, subplot(2,1,1), plot3(x, y, abs(E_phi)), xlabel('x'), ylabel('y'), zlabel('z'), title('E(phi) amplitude')
subplot(2,1,2), plot3(x, y, angle(E_phi)), xlabel('x'), ylabel('y'), zlabel('z'), title('E(phi) phase')
Since, I did't see use of angle phi so I assumed it to be 0 and assumed value of radius to be 1. I hope it will help you
12 Comments
sixwwwwww
on 13 Oct 2013
You should keep the original equations and you can put them here in a nice way like code(as me and Youssef) did so that I can solve it. You can make your code nicer by first putting code here then selecting it and then press "{}Code" button to make it nicer. Also try to put the values for "phi" and "radius" as well then I will try to solve it for you
sixwwwwww
on 13 Oct 2013
Dear Navdeep, for value of phi = 0 we get Y = 0 because sin(0) = 0 so we can't evaluate sin(Y) / Y and for phi = 90 we get X = 0 because cos(90) = 0 so we can't evaluate sin(X) / X. So in both of these "phi" cases we can't evaluate the equations. So what do you suggest? Should we calculate E_theta and E_phi for values of phi other than 0 and 90?
sixwwwwww
on 13 Oct 2013
Ok I got it you want it to use L'Hospital's Rule. I try to formulate it now
sixwwwwww
on 13 Oct 2013
Dear Navdeep, here is your code:
r = 1;
theta_degree = -90:90;
theta = degtorad(theta_degree);
theta = theta(theta ~= 0);
phi_degree = [0 90];
phi = degtorad(phi_degree);
for i = 1:length(phi)
if phi_degree(i) == 0
Y = 0;
sinYY = 1;
else
Y = 5 * pi * sin(theta) * sin(phi(i));
sinYY = sin(Y) ./ Y;
end
if phi_degree(i) == 90
X = 0;
sinXX = 1;
else
X = 3 * pi * sin(theta) * cos(phi(i));
sinXX = sin(X) ./ X;
end
E_theta = (1j / r) * 30 * exp (-1j * 2 * pi) * sin(phi(i)) * sinXX * sinYY;
E_phi = (1j / r) * 30 * exp(-1j * 2 * pi) * cos(theta) * cos(phi(i)) .* sinXX .* sinYY;
[x,y,z] = sph2cart(theta,phi(i),r);
figure, plot3(x, y, abs(E_theta)), xlabel('x'), ylabel('y'), zlabel('E(theta) amplitude'), title(strcat('E(theta) amplitude for phi =',...
num2str(phi_degree(i))))
figure, plot3(x, y, angle(E_theta)), xlabel('x'), ylabel('y'), zlabel('E(theta) phase'), title(strcat('E(theta) amplitude for phi =',...
num2str(phi_degree(i))))
figure, plot3(x, y, abs(E_phi)), xlabel('x'), ylabel('y'), zlabel('E(phi) amplitude'), title(strcat('E(phi) amplitude for phi =',...
num2str(phi_degree(i))))
figure, plot3(x, y, angle(E_phi)), xlabel('x'), ylabel('y'), zlabel('E(phi) phase'), title(strcat('E(phi) amplitude for phi =',...
num2str(phi_degree(i))))
end
If you can't understand something, feel free to ask. Also if you like my answer then accept the answer to make others to find the solution as well if they are looking for similar question. Good luck!
sixwwwwww
on 13 Oct 2013
Dear Navdeep, now see this code, it will give you exact output as you need:
r = 1;
theta_degree = -90:0.01:90;
theta = degtorad(theta_degree);
theta = theta(theta ~= 0);
phi_degree = [0 90];
phi = degtorad(phi_degree);
for i = 1:length(phi)
if phi_degree(i) == 0
Y = 0;
sinYY = 1;
else
Y = 5 * pi * sin(theta) * sin(phi(i));
sinYY = sin(Y) ./ Y;
end
if phi_degree(i) == 90
X = 0;
sinXX = 1;
else
X = 3 * pi * sin(theta) * cos(phi(i));
sinXX = sin(X) ./ X;
end
E_theta = (1j / r) * 30 * exp (-1j * 2 * pi) * sin(phi(i)) * sinXX * sinYY;
E_phi = (1j / r) * 30 * exp(-1j * 2 * pi) * cos(theta) * cos(phi(i)) .* sinXX .* sinYY;
[x,y,z] = sph2cart(theta,phi(i),r);
figure, plot3(x, y, abs(E_theta)), xlabel('x'), ylabel('y'), zlabel('E(theta) amplitude'), title(strcat('E(theta) amplitude for phi =',...
num2str(phi_degree(i)))), view([90 0])
figure, plot3(x, y, abs(E_phi)), xlabel('x'), ylabel('y'), zlabel('E(phi) amplitude'), title(strcat('E(phi) amplitude for phi =',...
num2str(phi_degree(i)))), view([90 0])
end
Feel free to ask if you can't understand anything
sixwwwwww
on 13 Oct 2013
If you tell me how to convert current scale in graph to "dB" scale then I can do it. I mean what is the formula to convert amplitude in to dB units?
sixwwwwww
on 13 Oct 2013
no we are plotting them separately. do you want to plot them combined?
sixwwwwww
on 13 Oct 2013
Navdeep we can plot combine. but i checked that graph doesn't look good in dB scale. It doesn't look like the figure you attached. So what you say?
sixwwwwww
on 13 Oct 2013
I did but it doesn't look good. But maybe you can also try by yourself. Here is the code:
r = 1;
theta_degree = -90:0.01:90;
theta = degtorad(theta_degree);
theta = theta(theta ~= 0);
phi_degree = [0 90];
phi = degtorad(phi_degree);
for i = 1:length(phi)
if phi_degree(i) == 0
Y = 0;
sinYY = 1;
else
Y = 5 * pi * sin(theta) * sin(phi(i));
sinYY = sin(Y) ./ Y;
end
if phi_degree(i) == 90
X = 0;
sinXX = 1;
else
X = 3 * pi * sin(theta) * cos(phi(i));
sinXX = sin(X) ./ X;
end
E_theta = (1j / r) * 30 * exp (-1j * 2 * pi) * sin(phi(i)) * sinXX * sinYY;
E_phi = (1j / r) * 30 * exp(-1j * 2 * pi) * cos(theta) * cos(phi(i)) .* sinXX .* sinYY;
E = E_theta + E_phi;
E_dB = 10 * log(E);
[x,y,z] = sph2cart(theta,phi(i),r);
figure, plot3(x, y, abs(E)), xlabel('x'), ylabel('y'), zlabel('Radiation Intensity'), title(strcat('Radiation Intensity at phi=',...
num2str(phi_degree(i)))), view([90 0])
figure, plot3(x, y, abs(E_dB)), xlabel('x'), ylabel('y'), zlabel('Radiation Intensity [dB]'), title(strcat('Radiation Intensity at phi=',...
num2str(phi_degree(i)))), view([90 0])
end
You will get 4 figures. second and fourth figures are in dB scales
sixwwwwww
on 13 Oct 2013
Here is your code:
r = 1;
theta_degree = -90:0.01:90;
theta_degree = theta_degree(theta_degree ~= 0);
theta = degtorad(theta_degree);
phi_degree = [0 90];
phi = degtorad(phi_degree);
for i = 1:length(phi)
if phi_degree(i) == 0
Y = 0;
sinYY = 1;
else
Y = 5 * pi * sin(theta) * sin(phi(i));
sinYY = sin(Y) ./ Y;
end
if phi_degree(i) == 90
X = 0;
sinXX = 1;
else
X = 3 * pi * sin(theta) * cos(phi(i));
sinXX = sin(X) ./ X;
end
E_theta = (1j / r) * 30 * exp (-1j * 2 * pi) * sin(phi(i)) * sinXX * sinYY;
E_phi = (1j / r) * 30 * exp(-1j * 2 * pi) * cos(theta) * cos(phi(i)) .* sinXX .* sinYY;
E = E_theta + E_phi;
E = E / max(E);
E_dB = 10 * log(E);
figure, plot(theta_degree, abs(E)), xlabel('Angle [theta]'), ylabel('Normalized Radiation Intensity'), title(strcat('Radiation Intensity at phi=',...
num2str(phi_degree(i))))
figure, plot(theta_degree, abs(E_dB)), xlabel('Angle [theta]'), ylabel('Normalized Radiation Intensity [dB]'),...
title(strcat('Radiation Intensity at phi=', num2str(phi_degree(i))))
end
I forgot to ask you. Is it your homework? Tell me truly hahhahha
sixwwwwww
on 13 Oct 2013
hahahhaha. It's not fair you should have told me before and now I should get marks instead of you. lolx. You can add grid the following way:
figure, plot(theta_degree, abs(E)), xlabel('Angle [theta]'), ylabel('Normalized Radiation Intensity'), title(strcat('Radiation Intensity at phi=',...
num2str(phi_degree(i)))), grid on
Abdul Lawal
on 28 Jan 2016
Hey sixwwwwww, I need to plot the two-way radiation pattern of a planar array for my SAR antenna for both elevation and azimuth. The figures are necessary as input to my Noise Equivalent Sigma Zero (NESZ) computation. Can you please help?
More Answers (0)
Categories
Find more on Time Series Events in Help Center and File Exchange
Tags
No tags entered yet.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)