how can i plot radiation pattern in cartesian coordinate in matlab ?

 Réponse acceptée

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 commentaires

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
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?
Ok I got it you want it to use L'Hospital's Rule. I try to formulate it now
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!
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
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?
no we are plotting them separately. do you want to plot them combined?
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?
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
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
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
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?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by