How to I find x in sin(x) = 0.65
54 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(3 个)
John D'Errico
2022-3-21
编辑:John D'Errico
2022-3-21
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 个评论
Sam Chak
2022-3-21
编辑:Sam Chak
2022-3-21
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!