I want to plot graph when alpha =2.8 or 2.9, but the graph not appear.

6 views (last 30 days)
Dear Sir,
I want to plot the graph for alpha=2.8 or 2.9. But the graph not appear.
Anyone can help me
clear all
close all
theetasd = -90:.01:90; %Defining X axis vector
theetaid = 30; %Variable Theeta i in degrees
phisd = 90;
theetai = theetaid * pi/180; %Variable Theeta i in radian
theetas = theetasd * pi/180; %Variable Theeta s in radian
phis = phisd * pi/180;
ay =1 ;
az= 1;
lembda = 0.8;
beeta = 8;
a = 5*lembda;
b = 5*lembda;
syms r
part1=-(j.*eita.*a.*b.*H0.*((pi./2).^0.5).*(beeta.*d.*cos(theetai)).^abs((3-alpha)/2).* besselh(abs((3-alpha)/2),1,(beeta.*d.*cos(theetai))).* beeta.*(2.^(3-alpha)).*((pi).^0.5)./2);
Ei = n.*H0.*((pi./2).^0.5).*((ay.*cos(theetai))+(az.*sin(theetai))).*(beeta.*z.*cos(theetai)).^abs((3-alpha)/2).*(exp(-j.*beeta.*((y.*sin(theetai))))).*besselh(abs((3-alpha)/2),1,(beeta.*d.*cos(theetai)));
%Equation for Es-Phi
p = beeta.*a./2.*(sin(theetas).*cos(phis));
q = beeta.*b./2.*((sin(phis).*sin(theetas))-sin(theetai));
Esth = (C.*exp(-j.*beeta.*r)./r.^(alpha-2)).*((cos(theetas)).*sin(phis).*(((sin(p)./(p)).*(sin(q))./(q))));
Esphi = (C.*exp(-j.*beeta.*r)./r.^(alpha-2)).*(cos(phis).*(((sin(p))./(p)).*(sin(q))./(q)));
%Equation for Es
%Equation for Sigma
sigma = limit((4.*pi.*r.^2).*abs((Esth).^2/(Ei).^2), r, inf);
sigma = 5*log( sigma);
  1 Comment
the cyclist
the cyclist on 23 Mar 2023
I suggest that you learn to use the debugging tools that MATLAB provides. You can set a breakpoint at the plotting line, and see what is going on.
In this case, I can see that every value of sigma is Inf. I did not trace back why that happens.

Sign in to comment.

Accepted Answer

Sandeep on 27 Mar 2023
Hi mohd akmal masud,
It is my understanding that you are facing an issue in plotting a Graph simulating Electromagnetic wave propagation. The reason is that the sigma variable is a scalar value and cannot be plotted against a vector. In the last line of the code, sigma is assigned a scalar value by taking the logarithm of a limit expression. Therefore, when plot(theetasd, sigma, 'black--') is executed, MATLAB throws an error because it is not possible to plot a scalar value against a vector.
To fix this, you could modify the code to store the conductivity values for each value of theetasd in a vector, rather than just a single scalar value. You could initialize an empty vector sigma_vals and then assign the calculated sigma value to sigma_vals(i) at each iteration of the loop. Then, you can plot the resulting sigma_vals vector against theetasd.
For more insite on Plot function refer:

Sign in to comment.

More Answers (0)


Find more on Graph and Network Algorithms 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!

Translated by