How to solve for multiple roots
조회 수: 22 (최근 30일)
이전 댓글 표시
Hello, I am trying to solve the first 500 roots of the following equation tan (x)= (3x)/(3+(60.5*(x^2)) But I cannot figure out how to do it. Any help will be appreciated.
댓글 수: 0
채택된 답변
John D'Errico
2018년 11월 4일
편집: John D'Errico
2018년 11월 4일
The first 500 roots? Why 500? Are there 500 such roots?
By the way, I think you need to learn to use fewer parens.
f = @(x) tan(x) - 3*x./(3+60.5*x.^2);
One root clearly lies at x == 0. In fact, quick examination suggests that n*pi is a good approximation to all non-negative roots.
f(pi*(0:10))
ans =
0 -0.015705 -0.0078821 -0.0052584 -0.0039448 -0.0031562 -0.0026303 -0.0022546 -0.0019728 -0.0017537 -0.0015783
So just use a loop, calling fzero for each starting value n*pi.
xn = zeros(1,11);
for n = 1:10;
xn(n+1) = fzero(f,n*pi);
end
xn
xn =
Columns 1 through 7
0 3.15721947602233 6.29105738669815 9.43003337009966 12.570314108792 15.7111187818028 18.8521858417768
Columns 8 through 11
21.9934029606895 25.134713911635 28.2760874364729 31.4175047721421
ezplot(f,[0,35])
hold on
refline(0,0)
plot(xn,0,'ro')
댓글 수: 0
추가 답변 (2개)
madhan ravi
2018년 11월 4일
syms x
e1=tan(x)==(3*x)/(3+(60.5*(x^2)))
vpasolve(e1,x,1)
댓글 수: 1
madhan ravi
2018년 11월 4일
편집: madhan ravi
2018년 11월 4일
For multiple roots you have to specify the interval
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!