Evaluating polynomials in Matlab

  • Context: MATLAB 
  • Thread starter Thread starter qubits135
  • Start date Start date
  • Tags Tags
    Matlab Polynomials
Click For Summary
SUMMARY

To evaluate polynomials in MATLAB, users should utilize the subs function for symbolic expressions defined with syms. For numerical evaluations, the polyval command is recommended, where 'h' represents the vector of polynomial coefficients. This approach allows for efficient evaluation of polynomials at specific values of 'x'. The discussion highlights the limitations of alternative systems that treat polynomials as matrices, which complicates operations like integration and differentiation.

PREREQUISITES
  • Familiarity with MATLAB syntax and environment
  • Understanding of symbolic mathematics in MATLAB
  • Knowledge of polynomial representation and evaluation
  • Basic concepts of numerical methods in programming
NEXT STEPS
  • Explore the subs function in MATLAB for symbolic expression evaluation
  • Learn about the polyval function for polynomial evaluation
  • Investigate polynomial manipulation techniques in MATLAB
  • Study the differences between symbolic and numerical computations in MATLAB
USEFUL FOR

Mathematics students, MATLAB users, engineers, and anyone involved in symbolic computation or polynomial evaluations in MATLAB.

qubits135
Messages
2
Reaction score
0
I defined x as a syms, then work with polynomials involving x. But then I can't find an evaluation command for these polynomials at some x value. Anyone knows how I can get it to work? Thank you in advance.

There's another system where you can define polynomials just like matrices, e.g. x^2+1 as [1 0 1]. But they only have elementary manipulation, and it becomes really cumbersome doing integral or derivative. (that was why I went the traditional way, which is the one mentioned above).

Thanx
 
Physics news on Phys.org
The command polyval(h,x), where 'h' is a vector of the coefficients of an nth degree polynomial, evaluates a polynomial at each point 'x'.
 
  • Like
Likes   Reactions: FactChecker

Similar threads

  • · Replies 10 ·
Replies
10
Views
3K
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
2K