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