Azzera filtri
Azzera filtri

Bisection method for finding angle

1 visualizzazione (ultimi 30 giorni)
Angelina Encinias
Angelina Encinias il 30 Ago 2022
Risposto: Sam Chak il 31 Ago 2022
Help with code
  3 Commenti
Angelina Encinias
Angelina Encinias il 30 Ago 2022
How would I find this angle?
Steven Lord
Steven Lord il 30 Ago 2022
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.

Accedi per commentare.

Risposte (1)

Sam Chak
Sam Chak il 31 Ago 2022
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.

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by