Problem using the 'subs' command(Error using symengine)
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jen Cong Wong
am 11 Dez. 2017
Beantwortet: Birdman
am 12 Dez. 2017
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 Kommentare
Akzeptierte Antwort
Birdman
am 12 Dez. 2017
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!