Lecture 06 Polynomial Handling -Computing Tools For Mathematics(COMP1118)
Computing Tools For Mathematics(COMP1118)
Instructor : Engineer Imran Ahmad
University Of Okara (Renala Campus)
The coefficients of the polynomial, real or complex arranged in descending power of x, placed in brackets.
For example
〖 𝑦(𝑥)=3𝑥〗^4+〖2𝑥〗^3+𝑥^2−𝑥+5;
Then the Y, MATLAB vector that represents the polynomial y(x) is given by:
≫𝑌=[3 2 1 −1 5];
Polynomial REPRESENTATION IN matlab
In general, if
y(𝑥)=𝑎_𝑛 𝑥^𝑛+"an−" 1"x n−1"+…+𝑎_1 𝑥+𝑎_0
Then the polynomial expressed as a MATLAB vector Y is given by
𝑌=[𝑎_𝑛 "an−" 1〖….. 𝑎〗_1 〖 𝑎〗_0]
When some coefficients of a polynomial are not present, then the missing coefficients are entered as zeros. For example:
〖𝑦(𝑥)=8𝑥〗^7+〖6𝑥〗^6+〖3𝑥〗^4+𝑥^2
Y is given by: 𝑌=[8 6 0 3 0 1 0 0 ]
Polynomial: roots
Let p(x) be a polynomial of a single variable (x), define by a row MATLAB vector P.
Then the MATLAB function r=roots(P) returns the column vector r with the roots of the polynomial p(x).
Example: 〖𝑝(𝑥)=8𝑥〗^7+〖6𝑥〗^6+〖3𝑥〗^4+𝑥^2
P=[8 6 0 3 0 1 0 0 ];
r=roots(P)
Evaluate a polynomial
Let the polynomial p(x) be defined by a row vector P, then the MATLAB function polyval(P,k) return the polynomial p(x) evaluated at x=k
Example: 𝑝(𝑦)=〖2𝑦〗^3+3𝑦−1
p=[2 0 3 -1]
polyval(P,0)
Ans: -1
Addition/ Subtraction of Polynomial
MATLAB can perform the addition or subtraction of two polynomials represented by P and Q, only if the two (MATLAB) vectors (P and Q) have the same number of elements(length of size)
Example:
〖𝑝(𝑥)=8𝑥〗^4+〖6𝑥〗^3+x−1
〖𝑞(𝑥)=10𝑥〗^3−〖3𝑥〗^2+6
MUNTIPLICATION OF POLYNOMIALS
MATLAB function M=conv(P,Q) returns the row vector M consisting of the coefficients of the product of the two polyomials, p(x) by q(x) represented as row vectors P and Q.
Example:
p(x)= 5x+2
q(x)= 2x+7
Partial fraction expansion of polynomial
let H(x) be a rational function of the form H(x)=P(x)/Q(x) then the partial fraction expansion can be accomplished by using the MATLAB function [r , p ,k]=residue(P,Q)
where r are the partial fraction coefficients, p the root of Q (also called poles) and k
represents the gain or stand-alone term.
Example : 〖𝑃(𝑥)=9𝑥〗^3+〖8𝑥〗^2+7𝑥+6
〖𝑄(𝑥)=5𝑥〗^3+〖4𝑥〗^2+3𝑥+2
Polynomial solutions
The MATLAB symbolic function y=solve(eq1), or solve (eq1,eq2,eq3…..) returns the symbolic solution of an equation or the system of equation given by eq1 , eq2,…..,eqn.
Example:
A= 𝑥^2=9
B= 𝑥−0.5𝑦+1.5z=5
6𝑥+4𝑦−2𝑧=10
𝑥−𝑦−𝑧=−1
Instructor : Engineer Imran Ahmad
University Of Okara (Renala Campus)
Lecture 06
Polynomial Handling
Polynomial
MATLAB inputs a polynomial of one variable x, as a row vector having as elements.The coefficients of the polynomial, real or complex arranged in descending power of x, placed in brackets.
For example
〖 𝑦(𝑥)=3𝑥〗^4+〖2𝑥〗^3+𝑥^2−𝑥+5;
Then the Y, MATLAB vector that represents the polynomial y(x) is given by:
≫𝑌=[3 2 1 −1 5];
Polynomial REPRESENTATION IN matlab
In general, if
y(𝑥)=𝑎_𝑛 𝑥^𝑛+"an−" 1"x n−1"+…+𝑎_1 𝑥+𝑎_0
Then the polynomial expressed as a MATLAB vector Y is given by
𝑌=[𝑎_𝑛 "an−" 1〖….. 𝑎〗_1 〖 𝑎〗_0]
When some coefficients of a polynomial are not present, then the missing coefficients are entered as zeros. For example:
〖𝑦(𝑥)=8𝑥〗^7+〖6𝑥〗^6+〖3𝑥〗^4+𝑥^2
Y is given by: 𝑌=[8 6 0 3 0 1 0 0 ]
Polynomial: roots
Let p(x) be a polynomial of a single variable (x), define by a row MATLAB vector P.
Then the MATLAB function r=roots(P) returns the column vector r with the roots of the polynomial p(x).
Example: 〖𝑝(𝑥)=8𝑥〗^7+〖6𝑥〗^6+〖3𝑥〗^4+𝑥^2
P=[8 6 0 3 0 1 0 0 ];
r=roots(P)
Evaluate a polynomial
Let the polynomial p(x) be defined by a row vector P, then the MATLAB function polyval(P,k) return the polynomial p(x) evaluated at x=k
Example: 𝑝(𝑦)=〖2𝑦〗^3+3𝑦−1
p=[2 0 3 -1]
polyval(P,0)
Ans: -1
Addition/ Subtraction of Polynomial
MATLAB can perform the addition or subtraction of two polynomials represented by P and Q, only if the two (MATLAB) vectors (P and Q) have the same number of elements(length of size)
Example:
〖𝑝(𝑥)=8𝑥〗^4+〖6𝑥〗^3+x−1
〖𝑞(𝑥)=10𝑥〗^3−〖3𝑥〗^2+6
MUNTIPLICATION OF POLYNOMIALS
MATLAB function M=conv(P,Q) returns the row vector M consisting of the coefficients of the product of the two polyomials, p(x) by q(x) represented as row vectors P and Q.
Example:
p(x)= 5x+2
q(x)= 2x+7
Partial fraction expansion of polynomial
let H(x) be a rational function of the form H(x)=P(x)/Q(x) then the partial fraction expansion can be accomplished by using the MATLAB function [r , p ,k]=residue(P,Q)
where r are the partial fraction coefficients, p the root of Q (also called poles) and k
represents the gain or stand-alone term.
Example : 〖𝑃(𝑥)=9𝑥〗^3+〖8𝑥〗^2+7𝑥+6
〖𝑄(𝑥)=5𝑥〗^3+〖4𝑥〗^2+3𝑥+2
Polynomial solutions
The MATLAB symbolic function y=solve(eq1), or solve (eq1,eq2,eq3…..) returns the symbolic solution of an equation or the system of equation given by eq1 , eq2,…..,eqn.
Example:
A= 𝑥^2=9
B= 𝑥−0.5𝑦+1.5z=5
6𝑥+4𝑦−2𝑧=10
𝑥−𝑦−𝑧=−1
Lecture 06 Polynomial Handling In Pdf File
Give great Concept on MATLAB
ReplyDeleteUNderstanable Lecture
ReplyDelete
ReplyDeletegreat
smart
sami
prince