How to solve symbolic and trigonometric equations simultaneous, two unknowns

3 views (last 30 days)
I still try to solve this equation to obtain alpha and gamma
R = (0.034 0.097 0.049 0.08 0.33 0.12 1.08)
d is in degrees (144 115 119 80 69 52 59)
I tried this code, and substituting R (0.07) and d (-135) to check my code, it should be give alpha = 0.15 and gamma = 1.7
But still didn't work yet
%%
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 = d == atan((tanh(2*alpha*tan(gamma)+1)+tan(gamma))/(tan(gamma)-tanh(gamma)+2*alpha))
sol = solve ([expr1,expr2] , [alpha, gamma])
alphaSol = sol.alpha
gammaSol = sol.gamma
%%
syms alpha gamma %R d
R = 0.07;
d = -135;
[sol_alpha, sol_gamma] = vpasolve([(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))), d == atand((tanh(2*alpha*tan(gamma)+1)+tan(gamma))/(tan(gamma)-tanh(gamma)+2*alpha))], [alpha,gamma])
They will give error :
  • Undefined function 'atand' for input arguments of type 'sym'.
  • sol_alpha = Empty sym: 0-by-1 sol_gamma = Empty sym: 0-by-1
I don't know anymore how to fix it,
Maybe anyone have any idea to help me, please?

Accepted Answer

Walter Roberson
Walter Roberson on 3 Aug 2022
d == atand((tanh(2*alpha*tan(gamma)+1)+tan(gamma))/(tan(gamma)-tanh(gamma)+2*alpha))
take tand() of both sides of that, getting
tand(d) == ((tanh(2*alpha*tan(gamma)+1)+tan(gamma))/(tan(gamma)-tanh(gamma)+2*alpha))

More Answers (1)

Torsten
Torsten on 3 Aug 2022
Edited: Torsten on 3 Aug 2022
Your equation has several solution, as already demonstrated in a previous post.
Here is one of them:
syms alpha gamma %R d
%R = [0.034 0.097 0.049 0.08 0.33 0.12 1.08];
%d = [144 115 119 80 69 52 59]
R = 0.07;
d = -135;
%for i=1:numel(R)
%[sol_alpha(i), sol_gamma(i)] = vpasolve([R(i)^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))), tand(d(i)) == (tanh(2*alpha*tan(gamma)+1)+tan(gamma))/(tan(gamma)-tanh(gamma)+2*alpha)], [alpha,gamma])
%end
[sol_alpha, sol_gamma] = vpasolve([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))), tand(d) == (tanh(2*alpha*tan(gamma)+1)+tan(gamma))/(tan(gamma)-tanh(gamma)+2*alpha)], [alpha,gamma])
sol_alpha = 
sol_gamma = 

Community Treasure Hunt

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

Start Hunting!