MATLAB This is what I have so far but Im positive it wont work and Im completely
ID: 3663417 • Letter: M
Question
MATLAB
This is what I have so far but Im positive it wont work and Im completely lost on this problem.
GIVEN: Finding zeroes of Bessel function Bessel functions have many applications in engineering, such as electromagnetic waves, heat conduction, modes of vibration, etc dxdx Write a Matlab script that will recreate the following table of the zeros of Bessel functions. n-1 n-3 n-4 o 2.40482555769577 5.52007811028631 8.65372791291101 11.79153443901420 14.93091770848770 3.8317059700751 7.01558666981561 10.17346813506270 13.32369193631420 16.47063005087760 5.13562230184068 8.41724414039986 11.61984117214900 14.79595178235120 17.95981949498780 J 6.38016189592398 9.76102312998166 13.01520072169840 16.22346616031870 19.40941522643500 4 7.58834243450380 11.06470948850110 14.37253667161750 17.61596604980480 20.82693295696230 s 8.77148381595995 12.33860419746690 15.70017407971160 18.98013387517990 22.21779989656120 9.93610952421768 13.58929017054120 17.00381966781600 20.32078921356650 23.58608443558130 11.08637001924500 14.82126872701310 18.28758283248170 21.64154101984840 24.93492788767300 12.22509226400460 16.03777419088770 19.55453643099700 22.94517313187460 26.26681464117660 13.35430047743530 17.24122038248910 20.80704778926410 24.23388525775050 27-58374896357 300 14.47550068655450 18.43346366696650 22.04698536469780 25.50945055418280 28.88737506353040 The first row of the table lists the first five zeros of the function Jo(x), the second row lists the first five zeros of the function Ji(x) etc. Use the bisection method to find the zeros. For each Bessel function Jolx), Ji(x). J2(x).. Jio(x)) you will need to automate an incremental search process to find appropriate brackets for the first five roots. These brackets are needed as input to the bisect function. This search process should be written as its own separate function that takes a J subscript value, starting x value, and number of desired root brackets as its input. This function would then return the brackets suitably stored in a matrix, e.g. Ist column stores xlower's, 2nd column stores xupper's, first row is the bracket for the first zero, second row is the bracket for the second zero etc. ANSWERS: Print your results of the bracket for J(x)in a 5x2 matrix. Create and print the table above (11x5). Legends (n=l, n=2. JoJu, etc.) are not required.Explanation / Answer
Try the following. The key here is to check for the tolerance everytime we iterate. Hopefully this will hekp :)
Arr1=3*Arr;
Array=zeros(Arr1,1);
for index=1:Arr1
% Initial guess of zeros
Arr0=1+sqrt(2)+(index-1)*pi+number+number^0.4;
% Do Halley's method
Array(index)=my_zeros(number,Arr0,choice);
if Array(index)==inf
error('This is wrong');
end
end
Array=sort(Array);
dx=[1;abs(diff(Array))];
Array=Array(dx>1e-8);
Array=Array(1:Arr);
function Array=my_zeros(number,Arr0,choice)
num1=number+1; num2=number*number;
tol=1e-12;
max=100;
error=1;
our_iterator=0;
while abs(error)>tol & our_iterator<max
switch choice
case 1
a=besselj(number,Arr0);
b=besselj(num1,Arr0);
case 2
a=bessely(number,Arr0);
b=bessely(num1,Arr0);
end
x02=Arr0*Arr0;
error=2*a*Arr0*(number*a-b*Arr0)/(2*b*b*x02-a*b*Arr0*(4*number+1)+(number*num1+x02)*a*a);
Array=Arr0-error;
Arr0=Array;
our_iterator=our_iterator+1;
end
if our_iterator>max-1
warning('This will get out of tolerance ','Try once again');
Array=inf;
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.