EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Data Science Data Science Tutorials Matlab Tutorial Polynomial in Matlab
 

Polynomial in Matlab

Priya Pedamkar
Article byPriya Pedamkar

Updated June 27, 2023

Polynomial in Matlab

 

 

What is Polynomial in Matlab?

Polynomials are general equations in mathematics that have coefficients and exponent values. In polynomials, exponent values are never negative integers, and it has only one unknown variable. Matlab polynomial are represented as vectors as well as a matrix. Operations such as poly, polyfit, residue, roots, polyval, polyvalm, conv, deconv, polyint, and polyder utilize various functions of polynomials. Various operations on equations use all these functions.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Syntax in Polynomial

Below is the syntax in Polynomial in Matlab:

1. Polyval ( a, 4 )

polyval (function name , variable value)

2. Polyvalm ( a, x )

polyvalm ( function name , variable matrix)

3. R = roots(a)

variable name = roots(function name)

4. Op = polyder(a)

output variable = polyder(input variable name)

5. Op = polyint ( a )

output variable = polyint(input variable name)

6. Op = conv ( a,b)

output variable = conv(polynomial1,polynomial2)

7. Op = dconv ( a,b)

output variable = conv(polynomial1,polynomial2)

How does polynomial work in Matlab?

Polynomial has various forms to evaluate in Matlab. In this, ‘poly’ is used to represent a general polynomial equation. ‘polyeig’ is used to represent Eigenvalue polynomials. ‘polyfit’ is used to represent curve fitting. ‘residue’ is used to represent roots of partial fraction expansion. ‘roots’ used to find roots of polynomials. ‘polyval’ is used to evaluate a polynomial. You can use the tool ‘polyvalm’ to solve problems that involve matrix variables. ‘conv’ is used to find convolution and multiplication of polynomials. ‘deconv’ is used to perform division and deconvolution of polynomials. ‘polyint’ is used for integration and ‘polyder’ is used for differentiation of polynomials.

Steps to Solve Polynomial in Matlab

Step 1: Accept Polynomial Vector.

Step 2: Use Function with Variable Value: Polyval (function Name, Variable Value):  Polyvalm ( Function Name, Variable Matrix )

Step 3: Display the Result.

Examples to Implement Polynomial in Matlab

Below are the examples to implement in Polynomial in Matlab:

Example #1

Consider one polynomial a ( x ) =  3 x^2 + 4x + 5

Code:

clear all ;
a = [ 3 4 5 ] polyval ( a , 4)

Output:

Polynomial in Matlab - 1

Example #2

Consider polynomial equation b ( x ) = 2 9 x^4 + 45 x^3 + 3 x^2 + 21 x + 1

Code:

clear all ;
b = [ 29 45 3 21 1 ] polyval (b , 2)

Output:

Polynomial in Matlab - 2

Example #3

Consider polynomial equation c ( x ) = 2x^2 + 3x + 4

Values of x in the form of the matrix, so,

X = 3     4     2

4     6     2

2     4     3

Code:

clear all ;
c = [ 2 3 4 ] x = [ 3 4 2 ; 4 6 2 ; 2 4 3 ] polyvalm (c ,x)

Output:

c ( x ) = 2x^2 + 3x + 4

Example #4

Consider one example b ( x ) = 2 9 x^4 + 45 x^3 + 3 x^2 + 21 x + 1

Along with the evaluation of polynomials, we can also find the roots of polynomials:

Code:

clear all ;
b = [29 45 3 21 1] polyval (b,2)
r = roots(b)

Output:

Polynomial in Matlab - 4

Example #5

Consider polynomial as 2x^3 +3x^2+5x+2

In this example, we will see how to find derivatives and integration of polynomial.

Code:

clear all;
eq1 = [2 3 5 2] op1 = polyder(eq1)
op2 = polyint(eq1)

Output:

2x^3 +3x^2+5x+2

Example #6

Consider two polynomials as eq1= 3x^3 + 4x^2 + 2x + 5 and eq2 = 4 x^2 + 2x + 2

This example illustrates the convolution and deconvolution of two polynomials:

Code:

clear all ;
eq1 = [3 4 2 5] eq2 = [ 4 2 2] op1 = conv(eq1,eq2)
op2 = deconv(eq1,eq2)

Output:

 Consider two polynomials

Conclusion

In the above sections, we have seen how to evaluate polynomials and how to find the roots of polynomials. Mathematically it is very difficult to solve long polynomials, but in Matlab, we can quickly evaluate equations and perform operations like multiplication, division, convolution, deconvolution, integration, and derivatives.

Recommended Articles

This is a guide to Polynomial in Matlab. Here we discuss an introduction, how polynomial work, and examples to implement with appropriate codes and outputs. You can also go through our other related articles to learn more –

  1. Natural Log in Matlab
  2. Matlab Create Function
  3. fminsearch in Matlab | How to Work?
  4. Matlab Gradient
  5. MATLAB Plot Function

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - ENROLL NOW