Solving a complicated symbolic equation

조회 수: 1 (최근 30일)
Orel
Orel 2023년 6월 2일
댓글: John D'Errico 2023년 6월 2일
Hello,
im trying to solve the following equation, A=B*x*sinh(x) (A and B are known constants) using symbolic toolbox:
syms x;
A=3;
B=9;
equation=A==B*x*sinh(x);
solution=solve(equation,x)
however i cannot find a solution.
i've tried using vpasolve as well but it still doesnt work.
will appreciate any advice.
  댓글 수: 1
John D'Errico
John D'Errico 2023년 6월 2일
solve fails, because there is no algebraic solution to your problem. However, both fzero and vpasolve will work, and the two answers you have gotten tell you that.
We cannot know why you think vpasolve failed, because we do not see what you tried. But vpasolve does not even desperately need a starting point. (It uses zero as I recall by default.) But a starting point is always a good idea.
syms x;
A=3;
B=9;
equation=A==B*x*sinh(x);
solution=vpasolve(equation,x)
solution = 
0.56248044921102851906187057960428

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

답변 (2개)

Matt J
Matt J 2023년 6월 2일
편집: Matt J 2023년 6월 2일
A=3;
B=9;
f=@(x)A-B*x*sinh(x);
[x,fval]=fzero(f,[0,10]) %first solution
x = 0.5625
fval = 1.3323e-15
[x,fval]=fzero(f,[-10,0]) %second solution
x = -0.5625
fval = 1.3323e-15

Pramil
Pramil 2023년 6월 2일
You can do the following :
syms x;
A = 3;
B = 9;
solution = vpasolve(B*x*sinh(x)==A, x, 1)
solution = 
0.56248044921102851906187057960428
The vpasolve function allows you to specify a starting value for the numerical solver, in this case, the starting value is 1. The output of this code will give you a single numerical value for x

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by