You are on page 1of 17

Name :

Areeb Akhtar

Roll no :
2k18 ele 059

Section :
P2
EXPERIMENT # 03
Objective

PART A: Dealing with Polynomials&


Partial Fraction Expansion
PART B: Plotting in Matlab
PART A: Dealing with
Polynomials
• Polynomials
• Polynomials arise frequently in systems
theory. MATLAB represents polynomials as
row vectors of polynomial coefficients. For
example, the polynomial s2 +4s−5 is
represented in MATLAB by the polynomial >>
p = [1 4 -5]. The following is a list of the more
important commands for manipulating
polynomials.
• roots(p): Express the roots of polynomial p as
a column vector
• polyval(p,x): Evaluate the polynomial p at
the values contained in the vector x
• conv(p1,p2): Computer the product of the
polynomials p1 and p2
• deconv(p1,p2): Compute the quotient of p1
divided by p2
roots
Determining Coefficients
from given Roots:
Finding value of Polynomial
at a given point
conv(p1,p2)
• Computes the product of the
polynomials p1 and p2
deconv(p1,p2
Compute the quotient of p1 divided by
p2
Derivative of
Polynomial function:
Integration of
Polynomial
Function:
Dealing with Partial
Fraction expansion:

• [R,P,K] = RESIDUE(B,A) finds the


residues, poles and direct term of a
partial fraction expansion of the
ratio of two polynomials B(s)/A(s).
• [B,A] = RESIDUE(R,P,K), with 3 input
arguments and 2 output
arguments, converts the partial
fraction expansion back to the
polynomials with coefficients in B
and A.
PART B: Plotting in
MATLAB
• The primary tool we will use for
plotting in MATLAB is plot().The
MATLAB environment provides a
wide variety of techniques to display
data graphically.
• Annotations can be added from the
Insert menu like labels, titles, legend,
line, arrows, textarrow, double
arrow, text box, rectangle, ellipse,
axes, light etc.
Customization of plots
There are many commands used to customize plots by
annotations, titles, axes labels,
etc.
A few of the most frequently used commands are
xlabel Labels x-axis
ylabel Labels y-axis
title Puts a title on the plot
grid Adds a grid to the plot
gtext Allows positioning of text with the mouse
text Allows placing text at specified coordinates of the plot
axis Allows changing the x and y axes
figure Create a figure for plotting
figure(n) Make figure number n the current figure
hold on Allows multiple plots to be superimposed on the same
axes
hold off Release hold on current plot
close(n) Close figure number n
subplot(a,b,c) Create an a × b matrix of plots with c the current
figure
orient Specify orientation of a figure
Procedure:
• Titles &
Labels:
• To put a title and label the axes, we use
• >>title (’text’)
• >>xlabel (’text’)
• >>ylabel (’text’)
Grids:
• A dotted grid may be added by
• >>grid
Line Styles &Colors
• b blue . point -
• c cyan o circle :
• g green x x-mark -.
• k black + plus --
• mmagenta * star
• r red s square
• wwhite d diamond
• y yellow v triangle (down)
^ triangle (up)
< triangle (left)
• triangle (right)
• p pentagram
• h hexagram

CONCLUSION :
From this lab , we learn how to write
polynomial , how to find roots how to take derivative
and integration and how to plot any wave in matlab.

You might also like