How to I find x in sin(x) = 0.65

47 Ansichten (letzte 30 Tage)
Eric Seinen
Eric Seinen am 21 Mär. 2022
Bearbeitet: Sam Chak am 21 Mär. 2022
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

Antworten (3)

John D'Errico
John D'Errico am 21 Mär. 2022
Bearbeitet: John D'Errico am 21 Mär. 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)
ans = 
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 = struct with fields:
x: [2×1 sym] parameters: k conditions: [2×1 sym]
sol.x
ans = 
sol.conditions
ans = 
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 = struct with fields:
x: [2×1 sym] parameters: k conditions: [2×1 sym]
sol.x
ans = 
There are primary solutions at 30 and 150 degrees, plus any integer multiple of 360 degrees.

Arif Hoq
Arif Hoq am 21 Mär. 2022
Bearbeitet: Arif Hoq am 21 Mär. 2022
a=sind(30)
a = 0.5000
x=asind(0.5) %Inverse sine in degrees
x = 30.0000

Sam Chak
Sam Chak am 21 Mär. 2022
Bearbeitet: Sam Chak am 21 Mär. 2022
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.

Tags

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by