필터 지우기
필터 지우기

How to solve simultaneous equation with trigonometric function

조회 수: 4 (최근 30일)
christina widyaningtyas
christina widyaningtyas 2022년 7월 26일
댓글: Torsten 2022년 7월 30일
Hello, any one can help me
syms alpha gamma R d
R = 0.08;
d = 1.4;
R^2 == 4*(alpha)^2 / [(2*(alpha)^2 + 1) * acos*(2*gamma) + (2*(alpha)^2 - 1) * cos*(2*gamma) + 2*alpha*(asin*(2*gamma)) - sin*(2*gamma)]
d == atan*[(atan(2*alpha*tan*gamma + 1) + tan*gamma) / (tan*gamma - atan*gamma + 2*alpha)]
sol = solve ([R^2, d] , [alpha, gamma])
alphaSol = sol.alpha
gammaSol = sol.gamma
I need to obtain alpha and gamma
There is : Error using acos
Not enough input arguments.
  • if I delete acos, another error is appear (cos, ect)

채택된 답변

KSSV
KSSV 2022년 7월 26일
You cannot write acos*(2*gamma) and tan*gamma. Note that they are function and they need someinput. It migh be: acos(2*gamma) and tan(gamma)
syms alpha gamma R d
R = 0.08;
d = 1.4;
R^2 == 4*(alpha)^2 / ((2*(alpha)^2 + 1) * acos(2*gamma) + (2*(alpha)^2 - 1) * cos(2*gamma) + 2*alpha*(asin(2*gamma)) - sin(2*gamma))
d == atan((atan(2*alpha*tan(gamma) + 1) + tan(gamma)) / (tan(gamma) - atan(gamma) + 2*alpha))
sol = solve ([R^2, d] , [alpha, gamma])
alphaSol = sol.alpha
gammaSol = sol.gamma
Though the above is not giving any solution, you need to check your expression properly.
  댓글 수: 17
Walter Roberson
Walter Roberson 2022년 7월 30일
Take the tand out of both sides of the second equation, so
tand(d) == tand(atand(Expression))
and simplify to
tand(d) == Expression
it makes it easier for vpasolve to find solutions
Torsten
Torsten 2022년 7월 30일
Seems there are several solutions to your equations:
R = 0.07;
d = -135;
fun = @(alpha,gamma)[4*alpha^2/((2*alpha^2+1)*cosh(2*gamma)+(2*alpha^2-1)*cos(2*gamma)+2*alpha*(sinh(2*gamma)-sin(2*gamma)))-R^2;...
(tanh(2*alpha*tan(gamma)+1)+tan(gamma))/(tan(gamma)-tanh(gamma)+2*alpha)-tand(d)];
options = optimset('TolFun',1e-8,'TolX',1e-8);
alpha0 = 0.15;
gamma0 = 1.7;
x0 = [alpha0,gamma0];
sol = fsolve(@(x)fun(x(1),x(2)),x0,options);
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
alpha = sol(1)
alpha = 0.1786
gamma = sol(2)
gamma = 1.7811
fun(alpha,gamma)
ans = 2×1
1.0e-11 * 0.0055 -0.7673
alpha0 = -0.4;
gamma0 = -2.3;
x0 = [alpha0,gamma0];
sol = fsolve(@(x)fun(x(1),x(2)),x0,options);
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
alpha = sol(1)
alpha = -0.3679
gamma = sol(2)
gamma = -2.3475
fun(alpha,gamma)
ans = 2×1
1.0e-08 * -0.0013 0.1872
syms alpha gamma %R d
R = 0.07;
d = -135;
expr1 = R^2 == 4*alpha^2/((2*alpha^2+1)*cosh(2*gamma)+(2*alpha^2-1)*cos(2*gamma)+2*alpha*(sinh(2*gamma)-sin(2*gamma)));
expr2 = tand(d) == (tanh(2*alpha*tan(gamma)+1)+tan(gamma))/(tan(gamma)-tanh(gamma)+2*alpha);
[sol_alpha, sol_gamma] = solve([expr1,expr2], [alpha,gamma])
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
sol_alpha = 
sol_gamma = 
fun(double(sol_alpha),double(sol_gamma))
ans = 2×1
1.0e-15 * -0.0017 0.4441

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by