m-file function for solving high order polynomial equation
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Panitnart
am 1 Dez. 2014
Kommentiert: Star Strider
am 2 Dez. 2014
I want to build for solving polynomial equation for high order (example x^202+x^102+x^52+100) and apply other problem.
I write m-file in this form.
function [eig] = solvepoly(chareq)
eq = 'chareq';
eig = solve(eq);
end
Then I use this function. The answer isn't correct.
>> [eig] = solvepoly(@(x) x^2+2*x+1)
eig =
0
But I use this command in command window. I get this answer.
>> eq = 'x^2+2*x+1'; >> eig = xolve(eq)
eig =
-1 -1
Help me please.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 1 Dez. 2014
This is easier:
syms x
p = x^202+x^102+x^52+100;
r = roots(sym2poly(p));
The ‘r’ variable will have all 202 roots.
4 Kommentare
Star Strider
am 2 Dez. 2014
My pleasure!
The most sincere expression of thanks here on MATLAB Answers is to Accept the Answer that most closely solves your problem.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calculus 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!