how to use fsolve with interval
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi guys,
i got a problem with using fsolve, i want to define an interval for my problem but i can't.
This is my code
a = 20;
m = 12;
J = [0.01 0.02 0.05 0.1 0.2 0.5 1 2 5 10 20 50];
for j = 1:m
for i = 1:a
fnA=@(x) x*besselj(1,x)/besselj(0,x)-J(j);
A(i,j)=fsolve(fnA, i);
end
end
This code gives me roots of equation but it repeats roots sometimes. so i tried to replace this
A(i,j)=fsolve(fnA, i);
with
A(i,j)=fsolve(fnA, [start end]);
but i got error.
How can i solve it.
Thanks.
0 comentarios
Respuestas (1)
Walter Roberson
el 14 de Abr. de 2019
fsolve() does not permit intervals to be specified.
fzero() permits specifying intervals. fzero() is restricted to single equations in one variable, which it appears might be good enough for your purpose.
5 comentarios
Walter Roberson
el 15 de Abr. de 2019
At the moment I do not see any connection between the A you solve for and the A you give the equation for.
Bi is given a subscript of i but not of n, which implies that as used in the equation for A that it should be independent of the n that is the variable of summation. But that seems weird. I suspect that B should be subscripted with n rather than i.
With Bi being Xn*J1/j0 and with it being used squared in A, that would be Xn^2*(J1/J0)^2 . But that is being used divided into Xn^2 in A, so that term would seem to calculate down to the simplier (J0/J1)^2.
I do not see any connection to eigenvalues.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
