Problem using the 'subs' command(Error using symengine)
조회 수: 20 (최근 30일)
이전 댓글 표시
I am trying to solve the cubic equation 0.75*k*B1^3 -m*w^2*B1 + c*B1 - A == 0 and get the absolute number for the roots. However, I encounter "Error using symengine" when I try to use replace the 'k' symbolic variable with 0 using 'subs' command. Below is my code. There is no problem if I enter some value other than 0 in the code.
syms A m c k w B1
eqn = 0.75*k*B1^3 -m*w^2*B1 + c*B1 - A == 0
sol = solve(eqn,B1)
root = abs(subs(sol, [k,m,c,A], [0,1,1,1]))
And below is the errors that I got:
Error using symengine The third argument must be an integer between 1 and the degree of the polynomial.
Error in sym/subs>mupadsubs (line 140) G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 125) G = mupadsubs(F,X,Y);
Error in NonlinearStudy (line 9) root = abs(subs(sol, [k,m,c,A], [0,1,1,1]))
댓글 수: 0
채택된 답변
Birdman
2017년 12월 12일
You should use subs command for coefficients before solving the equation.
syms A m c k w B1
eqn = 0.75*k*B1^3 -m*w^2*B1 + c*B1 - A == 0
eqn = subs(eqn,{k,m,c,A},{0,1,1,1})
sol = solve(eqn,B1)
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!