Solving equation using 'vpa' function

조회 수: 7 (최근 30일)
Tan
Tan 2023년 5월 17일
편집: Dyuman Joshi 2023년 5월 17일
I'm solving this eq: sin(x - 1.1556)+(sin(1.1556)*exp(-x/2.2683)) using vpa function but cannot solve, and below are my coding:
syms x;
x = solve(sin(x - 1.1556)+(sin(1.1556)*exp(-x/2.2683)));
vpa(x)
How can i solve this problem?
  댓글 수: 1
VBBV
VBBV 2023년 5월 17일
편집: VBBV 2023년 5월 17일
You can modify the code by assuming constraints on variable x as shown below
syms x;
assume(x >= 1.1556 & x < 5 )
warning('off')
sol = solve(sin(x - 1.1556)+(sin(1.1556)*exp(-x/2.2683)),x);
double(vpa(sol))
ans = 4.4275

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

답변 (2개)

KSSV
KSSV 2023년 5월 17일
syms x;
eqn = sin(x - 1.1556)+(sin(1.1556)*exp(-x/2.2683))==0;
solve(eqn,x)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
ans = 
0.00000000000055271527457236056353377918317335
vpasolve(eqn,x)
ans = 
0.00000000000055271527457236056353377918317335
  댓글 수: 1
Tan
Tan 2023년 5월 17일
the reference ans is: 4.4275

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


Dyuman Joshi
Dyuman Joshi 2023년 5월 17일
편집: Dyuman Joshi 2023년 5월 17일
The equation you have has multiple solutions, see plot below for reference.
If you want to return a particular solution, use vpasolve() with a specifc initial guess near that particular solution
syms x
eqn = sin(x - 1.1556)+(sin(1.1556)*exp(-x/2.2683));
fplot(eqn, [-5 25])
yline(0)
out = double(vpasolve(eqn == 0, x, 4))
out = 4.4275

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

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