How to I find x in sin(x) = 0.65
59 views (last 30 days)
Show older comments
Im new to matlab and am fine using a solve equation but when trying to find the answer to something with infinite solutions nothing occurs, I dont know how to add the domain the this equation and would like some assistance please
0 Comments
Answers (3)
John D'Errico
on 21 Mar 2022
Edited: John D'Errico
on 21 Mar 2022
Simple enough. I'll use solve, since you mentioned that. What happens if you just call solve?
syms x
solve(sin(x) == 0.5)
So there are two fundamentally different solutions. Of course, asin can return only one of them, and since the range of the function asin is [-pi/2,pi/2], then asin would return the solution at pi/6, or 30 degrees.
If you wanted to find all solutions, then add a qualifier to solve.
sol = solve(sin(x) == 0.5,'returnConditions',true)
sol.x
sol.conditions
So for integer values of k, the general solutions are the primary solutions, plus any integer multiple of 2*pi.
If you wanted to solve this in degrees, that becomes
sol = solve(sind(x) == 0.5,'returnConditions',true)
sol.x
There are primary solutions at 30 and 150 degrees, plus any integer multiple of 360 degrees.
0 Comments
Sam Chak
on 21 Mar 2022
Edited: Sam Chak
on 21 Mar 2022
Hi @Eric Seinen
Not trying to confuse you, but here is the 3rd approach, the Numerical Approach.
fun = @(x) sin(x) - 0.65; % function, fun(x) = 0
x0 = 0; % initial point
x = fzero(fun, x0) % find the root when fun(x) = 0
x = 0.7076
Since the sine function is periodic, there are infinitely many solutions. However, there are two solutions in the principal domain . So, if you choose another initial point that is apart, then you will get another solution.
fun = @(x) sin(x) - 0.65; % function, fun(x) = 0
x0 = pi; % initial point
x = fzero(fun, x0) % % find the root when fun(x) = 0
x = 2.4340
@Arif Hoq's method is called the Inverse Function approach. The inverse of the sine function is called "arcsine". So, asin(y) can be used. It will return the value of x in radian.
However, sometimes certain equations are transcendental equations, where the equation cannot be solved for x algebraically. Because of this, the numerical approach is employed, which requires an iterative, a priori (initial-point-guessing) procedure. For example, the Kepler's equation:
.
@John D'Errico's method is called the Symbolical Approach, in which the solution is returned in the form of symbols.
0 Comments
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!