Want to use 'solve' with non symbolic variables
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lets say I had the equation:
ax^2+bx+c=0 (the real one is more complicated) and I wanted to get numeric solutions for x with given values of a b & c, but these values change constantly in the program. How could I use solve for this.
Thanks,
Chris
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 30 Sep. 2011
syms a b c
soln = matlabFunction(solve(a*x^2+b*x+c,x), 'vars', [a b c]);
Now call soln() passing in your numeric values for a, b, and c.
Warning: watch out for the fact that solve() might return multiple solutions!
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!