You are on page 1of 40

>> r=4

r=

>> p=2*pi*r

p=

25.1327

>> q=1/r

q=

0.2500

>> v1=[1 2]

v1 =

1 2

>> v2=[3 ; 4]

v2 =
3

>> A=[1 4 7 ; 2 5 8 ; 3 1 9]

A=

1 4 7

2 5 8

3 1 9

>> B=2*A

B=

2 8 14

4 10 16

6 2 18

>> B=B + A

B=

3 12 21

6 15 24

9 3 27
>> eye(3)

ans =

1 0 0

0 1 0

0 0 1

>> zeros(3,2)

ans =

0 0

0 0

0 0

>> ones(2,3)

ans =

1 1 1

1 1 1

>> C=A+B

C=
4 16 28

8 20 32

12 4 36

>> D=A-B

D=

-2 -8 -14

-4 -10 -16

-6 -2 -18

>> E=A*B

E=

90 93 306

108 123 378

96 78 330

>> Ai=inv(A)

Ai =

-1.2333 0.9667 0.1000

-0.2000 0.4000 -0.2000


0.4333 -0.3667 0.1000

>> At=A'

At =

1 2 3

4 5 1

7 8 9

>> trA=trace(A)

trA =

15

>> detA = det(A)

detA =

-30.0000

>> P=[3 -2 1]

P=

3 -2 1
>> zerosP=roots(P)

zerosP =

0.3333 + 0.4714i

0.3333 - 0.4714i

>> lookfor polynom

LagOp - Create a lag operator polynomial (LagOp) object

idpoly - Constructs or converts to a polynomial model with identifiable parameters.

poly1d - one-dimensional polynomial estimator object constructor.

localpoly - Polynomial class constructor

xreguncodedpoly - polynomial model without coding

laurpoly - Constructor for the class LAURPOLY (Laurent Polynomial).

conv - Convolution and polynomial multiplication.

deconv - Deconvolution and polynomial division.

polyeig - Polynomial eigenvalue problem.

mkpp - Make piecewise polynomial.

pchip - Piecewise Cubic Hermite Interpolating Polynomial.

poly - Convert roots to polynomial.

polyder - Differentiate polynomial.

polyfit - Fit polynomial to data.

polyint - Integrate polynomial analytically.

polyval - Evaluate polynomial.

polyvalm - Evaluate polynomial with matrix argument.

ppval - Evaluate piecewise polynomial.


roots - Find polynomial roots.

unmkpp - Supply details about piecewise polynomial.

mssgolay - provides least-squares polynomial smoothing of signals with peaks

bchgenpoly - Generator polynomial of BCH code.

cyclpoly - Produce generator polynomials for a cyclic code.

genpoly2b - Check the validity of RS generator polynomial and compute the


corresponding b

gfminpol - Find the minimal polynomial of an element of a Galois field.

gfpretty - Display a polynomial in traditional format.

gfprimck - Check whether a polynomial over a Galois field is primitive.

gfprimdf - Provide default primitive polynomials for a Galois field.

gfprimfd - Find primitive polynomials for a Galois field.

gfrepcov - Convert one binary polynomial representation to another.

gfroots - Find roots of a polynomial over a prime Galois field.

gfsub - Subtract polynomials over a Galois field.

isprimitive - Check whether a polynomial over a Galois field is primitive.

primpoly - Find primitive polynomials for a Galois field.

rsgenpoly - Generator polynomial of Reed-Solomon code.

rsgenpolycoeffs - Generator polynomial coefficients of Reed-Solomon code.

commblkCheckPolynomial - function for CRC generator and CRC

errlocp - calculates the error-location polynomial associated with BCH and

gfadd - Add polynomials over a Galois field.

gfconv - Multiply polynomials over a Galois field.

gfdeconv - Divide polynomials over a Galois field.

gffilter - Filter data using polynomials over a prime Galois field.

gftrunc - Minimize the length of a polynomial representation.

poly2trellis - Convert convolutional code polynomial to trellis description.

poly2str - Return polynomial as string.


mroots - Polynomial roots with multiplicity estimate

bspline - Plots a B-spline and its polynomial pieces.

fntlr - Taylor coefficients or polynomial

FitPolynomialExample - Polynomial Curve Fitting

dspblkpolyval - is the mask function for the DSP System Toolbox Polynomial Block

leja - Order roots in a way suitable to compute polynomial coefficients.

armax - Estimate ARMAX polynomial model using time domain data.

bj - Estimate Box-Jenkins polynomial model using time domain data.

oe - Estimate Output-Error polynomial model using time or frequency domain data.

polyest - Estimate polynomial model using time or frequency domain data.

poly2th - Constructs a "theta-matrix" from given polynomials.

polyform - computes the polynomials associated with a given model

th2poly - computes the polynomials associated with a given model.

fstab - Stabilize monic polynomial or square matrix A.

idpoly2str - POLY2STR Return polynomial as string.

isDiagonalPoly - Determine if off-diagonal polynomials in cell array P are 0 or empty.

localpolynomial -

ac2poly - Convert autocorrelation sequence to prediction polynomial.

lsf2poly - Line spectral frequencies to prediction polynomial.

poly2ac - Convert prediction polynomial to autocorrelation sequence.

poly2lsf - Prediction polynomial to line spectral frequencies.

poly2rc - Convert prediction polynomial to reflection coefficients (step-down).

polyscale - Scale roots of polynomial.

polystab - Polynomial stabilization.

rc2poly - Convert reflection coefficients to prediction polynomial (step-up).

signalpolyutils - utility functions for vectors of polynomial coefficients.


polyconf - Polynomial evaluation and confidence interval estimation.

polytool - Fits a polynomial to (x,y) data and displays an interactive graph.

refcurve - Add a reference curve (polynomial) to a plot.

charpoly - Characteristic polynomial of a matrix.

minpoly - Minimal polynomial of a matrix.

poly2sym - Polynomial coefficient vector to symbolic polynomial.

filters2lp - Filters to Laurent polynomials.

ls2lp - Lifting scheme to Laurent polynomials.

wave2lp - Laurent polynomials associated to a wavelet.

>> help roots

roots Find polynomial roots.

roots(C) computes the roots of the polynomial whose coefficients

are the elements of the vector C. If C has N+1 components,

the polynomial is C(1)*X^N + ... + C(N)*X + C(N+1).

Note: Leading zeros in C are discarded first. Then, leading relative

zeros are removed as well. That is, if division by the leading

coefficient results in overflow, all coefficients up to the first

coefficient where overflow occurred are also discarded. This process is

repeated until the leading coefficient is not a relative zero.

Class support for input c:

float: double, single

See also poly, residue, fzero.

Overloaded methods:
gf/roots

localpoly/roots

Reference page in Help browser

doc roots

>> help zpk

zpk Constructs zero-pole-gain model or converts to zero-pole-gain format.

Construction:

SYS = zpk(Z,P,K) creates a continuous-time zero-pole-gain (zpk) model

SYS with zeros Z, poles P, and gains K. SYS is an object of class @zpk.

SYS = zpk(Z,P,K,Ts) creates a discrete-time zpk model with sampling

time Ts (set Ts=-1 if the sampling time is undetermined).

S = zpk('s') specifies H(s) = s (Laplace variable).

Z = zpk('z',TS) specifies H(z) = z with sample time TS.

You can then specify zpk models directly as expressions in S or Z,

for example,

z = zpk('z',0.1); H = (z+.1)*(z+.2)/(z^2+.6*z+.09)

SYS = zpk creates an empty zero-pole-gain model.

SYS = zpk(D) specifies a static gain matrix D.

You can set additional model properties by using name/value pairs.

For example,
sys = zpk(1,2,3,'Variable','p','DisplayFormat','freq')

also sets the variable and display format. Type "properties(zpk)"

for a complete list of model properties, and type

help zpk.<PropertyName>

for help on a particular property. For example, "help zpk.ioDelay"

provides information about the "ioDelay" property.

Data format:

For SISO models, Z and P are the vectors of zeros and poles (set

Z=[] when there are no zeros) and K is the scalar gain.

For MIMO systems with NY outputs and NU inputs,

* Z and P are NY-by-NU cell arrays where Z{i,j} and P{i,j}

specify the zeros and poles of the transfer function from

input j to output i

* K is the 2D matrix of gains for each I/O channel.

For example,

H = zpk( {[];[2 3]} , {1;[0 -1]} , [-5;1] )

specifies the two-output, one-input zpk model

[ -5 /(s-1) ]

[ (s-2)(s-3)/s(s+1) ]

Arrays of zero-pole-gain models:

You can create arrays of zpk models by using ND cell arrays for Z,P

and a ND double array for K. For example, if Z,P,K are 3D arrays

of size [NY NU 5], then

SYS = zpk(Z,P,K)
creates the 5-by-1 array of zpk models

SYS(:,:,m) = zpk(Z(:,:,m),P(:,:,m),K(:,:,m)), m=1:5.

Each of these models has NY outputs and NU inputs.

To pre-allocate an array of zero zpk models with NY outputs and NU

inputs, use the syntax

SYS = zpk(ZEROS([NY NU k1 k2...])) .

Conversion:

SYS = zpk(SYS) converts any dynamic system SYS to the zpk

representation. The resulting SYS is of class @zpk.

See also zpk/exp, zpkdata, zpk, ss, frd, DynamicSystem.

Overloaded methods:

DynamicSystem/zpk

mfilt.zpk

adaptfilt.zpk

idParametric/zpk

mpc/zpk

dfilt.zpk

Reference page in Help browser

doc zpk

>> G=(2s+1)/(s^2+2s+1)

G=(2s+1)/(s^2+2s+1)
|

Error: Unexpected MATLAB expression.

>> G1=tf([2 1],[1 2 1])

G1 =

2s+1

-------------

s^2 + 2 s + 1

Continuous-time transfer function.

>> G2=zpk([-0.5],[-1 -1],2)

G2 =

2 (s+0.5)

---------

(s+1)^2

Continuous-time zero/pole/gain model.

>> G3=tf([4 3],[2 8 6])

G3 =
4s+3

---------------

2 s^2 + 8 s + 6

Continuous-time transfer function.

>> G3=zpk([-0.

G3=zpk([-3/4)],[-3 -1],4)

G3=zpk([-3/4)],[-3 -1],4)

Error: The expression to the left of the equals sign is not a valid target for an assignment.

>> G3=zpk([-3/4)],[-3 -1],4)

G3=zpk([-3/4)],[-3 -1],4)

Error: Unbalanced or unexpected parenthesis or bracket.

>> G3=zpk([-0.75)],[-3 -1],4)

G3=zpk([-0.75)],[-3 -1],4)

Error: Unbalanced or unexpected parenthesis or bracket.

>> G4=zpk([-0.75)],[-3 -1],4)

G4=zpk([-0.75)],[-3 -1],4)

Error: Unbalanced or unexpected parenthesis or bracket.


>> G4=zpk([-0.75],[-3 -1],4)

G4 =

4 (s+0.75)

-----------

(s+3) (s+1)

Continuous-time zero/pole/gain model.

>> Gs1=G1*G2

Gs1 =

4 (s+0.5)^2

-----------

(s+1)^4

Continuous-time zero/pole/gain model.

>> Gs2=series(G1,G2)

Gs2 =

4 (s+0.5)^2

-----------
(s+1)^4

Continuous-time zero/pole/gain model.

>> Gp1=G1+G2

Gp1 =

4 (s+0.5) (s+1)^2

-----------------

(s+1)^4

Continuous-time zero/pole/gain model.

>> Gp2=parallel(G1,G2)

Gp2 =

4 (s+0.5) (s+1)^2

-----------------

(s+1)^4

Continuous-time zero/pole/gain model.

>> Gf=feedback(G1,G2)

Gf =
2 (s+0.5) (s+1)^2

--------------------------------------------

(s^2 + 1.09s + 0.3067) (s^2 + 2.91s + 6.522)

Continuous-time zero/pole/gain model.

>> pole(G3)

ans =

-3

-1

>> step(G3)

>> bode(G3)

>> nyquist(G3)

>> nichols(G3)

>> pzmap(G3)

>> i

ans =

0.0000 + 1.0000i

>> j
ans =

0.0000 + 1.0000i

>> z1=1+2*i

z1 =

1.0000 + 2.0000i

>> z2=2+1.5*j

z2 =

2.0000 + 1.5000i

>> z3=z1+z2

z3 =

3.0000 + 3.5000i

>> z5=z1*z2

z5 =

-1.0000 + 5.5000i
>> Rz1=real(z1)

Rz1 =

>> Iz2=imag(z2)

Iz2 =

1.5000

>> conjz1=conj(z1)

conjz1 =

1.0000 - 2.0000i

>> r=abs(z1)

r=

2.2361

>> theta=angle(z2)
theta =

0.6435

>> z=r*exp(j*theta)

z=

1.7889 + 1.3416i

>> C=[1 2 ;3 4]+j*[5 6;7 8]

C=

1.0000 + 5.0000i 2.0000 + 6.0000i

3.0000 + 7.0000i 4.0000 + 8.0000i

>> D=[1+j*5 2+j*6;3+j*7 4+j*8]

D=

1.0000 + 5.0000i 2.0000 + 6.0000i

3.0000 + 7.0000i 4.0000 + 8.0000i

>> figure(1);

>> F1=tf([7*s 1*s],[12*s 3*s])

Undefined function or variable 's'.


>> lookfor polynom

LagOp - Create a lag operator polynomial (LagOp) object

idpoly - Constructs or converts to a polynomial model with identifiable parameters.

poly1d - one-dimensional polynomial estimator object constructor.

localpoly - Polynomial class constructor

xreguncodedpoly - polynomial model without coding

laurpoly - Constructor for the class LAURPOLY (Laurent Polynomial).

conv - Convolution and polynomial multiplication.

deconv - Deconvolution and polynomial division.

polyeig - Polynomial eigenvalue problem.

mkpp - Make piecewise polynomial.

pchip - Piecewise Cubic Hermite Interpolating Polynomial.

poly - Convert roots to polynomial.

polyder - Differentiate polynomial.

polyfit - Fit polynomial to data.

polyint - Integrate polynomial analytically.

polyval - Evaluate polynomial.

polyvalm - Evaluate polynomial with matrix argument.

ppval - Evaluate piecewise polynomial.

roots - Find polynomial roots.

unmkpp - Supply details about piecewise polynomial.

mssgolay - provides least-squares polynomial smoothing of signals with peaks

bchgenpoly - Generator polynomial of BCH code.

cyclpoly - Produce generator polynomials for a cyclic code.

genpoly2b - Check the validity of RS generator polynomial and compute the


corresponding b

gfminpol - Find the minimal polynomial of an element of a Galois field.


gfpretty - Display a polynomial in traditional format.

gfprimck - Check whether a polynomial over a Galois field is primitive.

gfprimdf - Provide default primitive polynomials for a Galois field.

gfprimfd - Find primitive polynomials for a Galois field.

gfrepcov - Convert one binary polynomial representation to another.

gfroots - Find roots of a polynomial over a prime Galois field.

gfsub - Subtract polynomials over a Galois field.

isprimitive - Check whether a polynomial over a Galois field is primitive.

primpoly - Find primitive polynomials for a Galois field.

rsgenpoly - Generator polynomial of Reed-Solomon code.

rsgenpolycoeffs - Generator polynomial coefficients of Reed-Solomon code.

commblkCheckPolynomial - function for CRC generator and CRC

errlocp - calculates the error-location polynomial associated with BCH and

gfadd - Add polynomials over a Galois field.

gfconv - Multiply polynomials over a Galois field.

gfdeconv - Divide polynomials over a Galois field.

gffilter - Filter data using polynomials over a prime Galois field.

gftrunc - Minimize the length of a polynomial representation.

poly2trellis - Convert convolutional code polynomial to trellis description.

poly2str - Return polynomial as string.

mroots - Polynomial roots with multiplicity estimate

bspline - Plots a B-spline and its polynomial pieces.

fntlr - Taylor coefficients or polynomial

FitPolynomialExample - Polynomial Curve Fitting

dspblkpolyval - is the mask function for the DSP System Toolbox Polynomial Block

leja - Order roots in a way suitable to compute polynomial coefficients.

armax - Estimate ARMAX polynomial model using time domain data.


bj - Estimate Box-Jenkins polynomial model using time domain data.

oe - Estimate Output-Error polynomial model using time or frequency domain data.

polyest - Estimate polynomial model using time or frequency domain data.

poly2th - Constructs a "theta-matrix" from given polynomials.

polyform - computes the polynomials associated with a given model

th2poly - computes the polynomials associated with a given model.

fstab - Stabilize monic polynomial or square matrix A.

idpoly2str - POLY2STR Return polynomial as string.

isDiagonalPoly - Determine if off-diagonal polynomials in cell array P are 0 or empty.

localpolynomial -

ac2poly - Convert autocorrelation sequence to prediction polynomial.

lsf2poly - Line spectral frequencies to prediction polynomial.

poly2ac - Convert prediction polynomial to autocorrelation sequence.

poly2lsf - Prediction polynomial to line spectral frequencies.

poly2rc - Convert prediction polynomial to reflection coefficients (step-down).

polyscale - Scale roots of polynomial.

polystab - Polynomial stabilization.

rc2poly - Convert reflection coefficients to prediction polynomial (step-up).

signalpolyutils - utility functions for vectors of polynomial coefficients.

polyconf - Polynomial evaluation and confidence interval estimation.

polytool - Fits a polynomial to (x,y) data and displays an interactive graph.

refcurve - Add a reference curve (polynomial) to a plot.

charpoly - Characteristic polynomial of a matrix.

minpoly - Minimal polynomial of a matrix.

poly2sym - Polynomial coefficient vector to symbolic polynomial.

filters2lp - Filters to Laurent polynomials.

ls2lp - Lifting scheme to Laurent polynomials.


wave2lp - Laurent polynomials associated to a wavelet.

>> tf([12 3])

ans =

From input 1 to output:

12

From input 2 to output:

Static gain.

>> R1=R2=10000

R1=R2=10000

Error: The expression to the left of the equals sign is not a valid target for an assignment.

>> R1=10000

R1 =

10000

>> R2=R1

R2 =
10000

>> C=10*10^(-6)

C=

1.0000e-05

>> C2=C1

Undefined function or variable 'C1'.

>> C1=C

C1 =

1.0000e-05

>> C2=C

C2 =

1.0000e-05

>> a=R2*C2+R1*C2+R1*C1

a=
0.3000

>> b=R1*C1*R2*C2

b=

0.0100

>> F=tf([1],[b a 1])

F=

--------------------

0.01 s^2 + 0.3 s + 1

Continuous-time transfer function.

>> F2=F

F2 =

--------------------

0.01 s^2 + 0.3 s + 1


Continuous-time transfer function.

>> bode(F2)

>> step(F2)

>> R1=1000

R1 =

1000

>> R2=R1

R2 =

1000

>> C=1*10^(-6)

C=

1.0000e-06

>> C1=C

C1 =

1.0000e-06
>> C2=C

C2 =

1.0000e-06

>> a=R2*C2+R1*C2+R1*C1

a=

0.0030

>> b=R1*C1*R2*C2

b=

1.0000e-06

>> F=tf([1],[b a 1])

F=

-----------------------

1e-06 s^2 + 0.003 s + 1


Continuous-time transfer function.

>> F3=F

F3 =

-----------------------

1e-06 s^2 + 0.003 s + 1

Continuous-time transfer function.

>> step(F3)

Error using handle.handle/get

Invalid or deleted object.

Error in graphics.datatip/movetofront>localDoClip (line 40)

hDataCursorInfo = get(hThis,'DataCursorHandle');

Error in graphics.datatip/movetofront (line 16)

inBounds = localDoClip(hThis);

Error in graphics.datatip/startDrag>localMarkerButtonDownFcn (line 67)

movetofront(hThis);

Error while evaluating line ButtonDownFcn


>> step(F3)

>> step(F3)

>> R1=1000

R1 =

1000

>> C1

C1 =

1.0000e-06

>> R1=10000

R1 =

10000

>> R1=R2

R1 =

10000

>> R1=10
R1 =

10

>> R2=R1

R2 =

10

>> C1=10*(10^-9)

C1 =

1.0000e-08

>> C2=C1

C2 =

1.0000e-08

>> a=R2*C2+R1*C2+R1*C1

a=
3.0000e-07

>> b=R1*C1*R2*C2

b=

1.0000e-14

>> F=tf([1],[b a 1])

F=

-----------------------

1e-14 s^2 + 3e-07 s + 1

Continuous-time transfer function.

>> step(F)

>> R1=10000

R1 =

10000

>> R2=R1
R2 =

10000

>> C1=1*10^(-9)

C1 =

1.0000e-09

>> C2=C1

C2 =

1.0000e-09

>> a=R2*C2+R1*C2+R1*C1

a=

3.0000e-05

>> b=R1*C1*R2*C2

b=

1.0000e-10
>> F=tf([1],[b a 1])

F=

-----------------------

1e-10 s^2 + 3e-05 s + 1

Continuous-time transfer function.

>> step(F)

>> R1=1000

R1 =

1000

>> R2=R2

R2 =

10000

>> R2=R1

R2 =
1000

>> C1=1*10^(-15)

C1 =

1.0000e-15

>> C2=C1

C2 =

1.0000e-15

>> a=R2*C2+R1*C2+R1*C1

a=

3.0000e-12

>> b=R1*C1*R2*C2

b=

1.0000e-24
>> R1=10000

R1 =

10000

>> R2=R1

R2 =

10000

>> C1=1*10^(-5)

C1 =

1.0000e-05

>> C2=C1

C2 =

1.0000e-05

>> a=R2*C2+R1*C2+R1*C1

a=
0.3000

>> b=R1*C1*R2*C2

b=

0.0100

>> F=tf([1],[b a 1])

F=

--------------------

0.01 s^2 + 0.3 s + 1

Continuous-time transfer function.

>> step(F)

>> R2=2*R1

R2 =

20000

>> C2=2*C1
C2 =

2.0000e-05

>> a=R2*C2+R1*C2+R1*C1

a=

0.7000

>> b=R1*C1*R2*C2

b=

0.0400

>> F=tf([1],[b a 1])

F=

--------------------

0.04 s^2 + 0.7 s + 1

Continuous-time transfer function.


>> step(F)

>> step(F)

>> step(F)

>> F=tf([1],[1 0.2 1])

F=

---------------

s^2 + 0.2 s + 1

Continuous-time transfer function.

>> figure(1);step(F)

>> figure(2);impulse(F)

>> F=tf([1],[1 0.01 1])

F=

----------------

s^2 + 0.01 s + 1

Continuous-time transfer function.

>> F=tf([1],[1 0.02 1])


F=

----------------

s^2 + 0.02 s + 1

Continuous-time transfer function.

>> figure(1);step(F)

>> figure(2);impulse(F)

>> F=tf([1],[1 0.002 1])

F=

-----------------

s^2 + 0.002 s + 1

Continuous-time transfer function.

>> figure(1);step(F)

>> figure(1);step(F)

>>

You might also like