필터 지우기
필터 지우기

Bisection method for finding angle

조회 수: 1 (최근 30일)
Angelina Encinias
Angelina Encinias 2022년 8월 30일
답변: Sam Chak 2022년 8월 31일
Help with code
  댓글 수: 3
Angelina Encinias
Angelina Encinias 2022년 8월 30일
How would I find this angle?
Steven Lord
Steven Lord 2022년 8월 30일
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sam Chak
Sam Chak 2022년 8월 31일
This should help you to visualize how to approach the problem. Since the solution space is between 0° and 90°, we can plot out the two functions over the range 0 to . and see where the intersection lies at.
x = linspace(0, pi/2, 1801);
yL = tan(x); % LHS function
yR = 1./(1 + exp(-x)); % RHS function
plot(x, yL, x, yR), grid, ylim([-0.5 1.5]), xlabel('x'), ylabel('y')
legend('LHS fcn', 'RHS fcn')
You can also transform the problem into a polynomial root-finding problem by applying Taylor series on the tangent and exponential functions:
Simplifying both sides and rearranging it yields a 7th-degree polynomial equation:
p7 = @(x) 4369/80640*x.^7 + 21/160*x.^5 + 17/48*x.^3 + 3/4*x - 1/2; % 7th-degree polynomial
fplot(p7, [0 pi/2])
grid, ylim([-0.5 0.5]), xlabel('x'), ylabel('y')
legend('p_7', 'location', 'east')
x0 = 0.6; % from 1st plot, we guess the initial point that is very close to the root
x = fzero(p7, x0) % finding the real root
x = 0.5683
This solution is merely an approximation, but a good one. Now, try applying the bisection method.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by