Can someone help me how to calculate theta?

조회 수: 9 (최근 30일)
Elham Rahimi
Elham Rahimi 2021년 10월 28일
댓글: Walter Roberson 2021년 11월 3일
a and b are variables calculated by measured values.
I dont know how should I define theta:
Error
Unrecognized function or variable 'theta'.
S = solve ((((a+b)*theta)/(theta^2 - (a*b))*tan_theta), theta)
  댓글 수: 5
Elham Rahimi
Elham Rahimi 2021년 11월 1일
편집: Elham Rahimi 2021년 11월 1일
a and b are values between (0.001-1.00)
tan (theta) is unknown as well
the error is "unrecognized function or variable theta"
I believe the equation is solvable since theta is the only unknown!
(tan(theta) = (a + b) .* theta ./ (theta.^2 - a * b)
Walter Roberson
Walter Roberson 2021년 11월 1일
What happens if, hypothetically, theta were 0?
tan(theta) = (a+b) * theta /(theta^2 - a*b)
tan(0) is 0
0 = (a+b) * 0 / (0^2 - a*b)
0 = 0 * (a+b) /(-a*b)
if a*b is not 0 then the denominator is not 0. 0 / nonzero is 0. So left side is 0 and right side is 0.
Therefore theta = 0 is a solution whenever neither a nor b is 0.

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

답변 (2개)

Uba K Ubamanyu
Uba K Ubamanyu 2021년 10월 28일
try fsolve with an initial guess.
I am assuming you meant to write tan(theta) instead of tan_theta
intial_guess =1;
S = fsolve(@(theta) (((a+b)*theta)/(theta^2 - (a*b))*tan(theta)), initial_guess)
  댓글 수: 1
Elham Rahimi
Elham Rahimi 2021년 10월 28일
I got this error!
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
Unrecognized function or variable 'theta'.
-- logically the equation should be solved for theta , I think basically something is wrong with my MATLAB code, which I cannt figure it out. fsolve is not working!

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


Walter Roberson
Walter Roberson 2021년 10월 29일
The solution is theta = 0 unless a or b are 0.
  댓글 수: 6
Elham Rahimi
Elham Rahimi 2021년 11월 3일
can you show the value for theta?
Walter Roberson
Walter Roberson 2021년 11월 3일
eqn = str2sym('tan(theta) == (894987427786373*theta)/(4503599627370496*(theta^2 - 710587193844941/72057594037927936))')
eqn = 
E2 = lhs(eqn) - rhs(eqn)
E2 = 
fplot([E2, 0], [-1 1])

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by