Trouble using symsum function to solve the Radiation Resistance eqn. for a finite dipole

3 次查看(过去 30 天)
%Radiation Resistance for finite dipole
C=0.5772;%This is Eulers const.
k=(2*pi)/300;%wave number
l=140e-2;% length of dipole
eta=120*pi;%impedance of free space
Rad_resist=(eta/(2*pi))*(C+log(k*l)-cos_integral(k*l)...
+.5*sin(k*l)*(sine_integral(2*k*l)-2*sine_integral(k*l))...
+.5*cos(k*l)*(C+log((k*l)/2)+cos_integral(2*k*l)-2*cos_integral(k*l)));
disp(Rad_resist)
%%%%%%%%%%%%%%%%%%%%%%%%%%%% Two functions that are called
function [c_i] = cos_integral(x)
%Cosine Integral
%Taken from Antenna Theory, Balanis
%9/5/2019
syms k;
C_euler_const=0.5772;%Eulers Constant
c_i=C_euler_const+log(x)+symsum(((((-1)^k)*((x)^(2*k)))/(2*k*factorial(2*k))),k,[1 100]);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [s_i] = sine_integral(x)
%Sine Integral
%Taken from Antenna Theory, Balanis
%9/5/2019
syms k;
s_i=symsum((((-1)^k)*(x^(2*k+1)))/((2*k+1)*factorial(2*k+1)),k,[1 100]);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%
output doesn't make sense; real summation limits should be 0 to Inf
val =
(189713413132327*pi^2)/337769972052787200000 - (2898399760547415523*pi^3)/12159718993900339200000000 + (129692640763094342591*pi^4)/4559894622712627200000000000 + (142021588266823360627*pi^5)/45598946227126272000000000000000 - (31776518994577836803303*pi^6)/115422332637413376000000000000000000 - (994151117867763524389*pi^7)/51298814505517056000000000000000000000 + (934239861683258850080753*pi^8)/692533..... keeps going...
These are the formulas I used from the book. Just wondering if I should go about a different method to solve this equation or if I'm missing something fundamentally important when using symsum function in MATLAB. Thank you!

采纳的回答

Nishant Gupta
Nishant Gupta 2019-9-11
Hi Brandon,
You can use vpa function to get the result as follows:
vpa(Rad_resist,4);
To see how vpa function works you can refer to the followign document:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MuPAD 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by