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