Hi guys,
i m trying to solve x*besselj(1,x)/besselj(0,x)-J(m) using fzero function
My code is
n = 100;J = [0.5 2 5 10 20 30 50 100];for i = 1:n A(i,1)=fzero('x*besselj(1,x)/besselj(0,x)-J(1)',i);endfor i = 1:n A(i,2)=fzero('x*besselj(1,x)/besselj(0,x)-J(2)',i);endfor i = 1:n A(i,3)=fzero('x*besselj(1,x)/besselj(0,x)-J(3)',i);endfor i = 1:n A(i,3)=fzero('x*besselj(1,x)/besselj(0,x)-J(4)',i);endfor i = 1:n A(i,3)=fzero('x*besselj(1,x)/besselj(0,x)-J(5)',i);endfor i = 1:n A(i,3)=fzero('x*besselj(1,x)/besselj(0,x)-J(6)',i);endfor i = 1:n A(i,3)=fzero('x*besselj(1,x)/besselj(0,x)-J(7)',i);endfor i = 1:n A(i,3)=fzero('x*besselj(1,x)/besselj(0,x)-J(8)',i);end
i am trying to write the code above
n = 100;J = [0.5 2 5 10 20 30 50 100];for j = 1:8 for i = 1:n A(i,m)=fzero('x*besselj(1,x)/besselj(0,x)-J(m)',i); endend
like that. when i run the code i get this error;
Error using fzero (line 306)FZERO cannot continue because user-supplied expression ==> x*besselj(1,x)/besselj(0,x)-J(m) failed with the error below. Error in inline expression ==> x*besselj(1,x)/besselj(0,x)-J(m) Undefined function or variable 'm'.Error in Untitled (line 6) A(i,m)=fzero('x*besselj(1,x)/besselj(0,x)-J(m)',i);
Can you help to solve this.
Thanks
Best Answer