4 views

Uploaded by muhammad

hghg

- (5) Material Balance as an Equation of Straight Line
- Algebraic Equation Solver
- Topic 02 - Polynomials - Features.doc
- 10 Merged
- Ws Elimination
- 2010_10_lyp_mathematics_sa1_03
- Acet - Syllabus 1_fac
- Advanced Coupling Matrix Synthesis Technique for UW Filters
- Files 2 Lectures Lec19
- parent child activity ryen
- Cameron 2003
- Grade 9 DLL Quarter 1
- vxcvdccd
- 4th Quadratics & Algebra.pdf
- Ecuación_diferencial
- activity_1_sometimes_always_never.pdf
- c 0352017022
- I
- حل معادلات درجه ۲و۳و۴.xls
- iwwwfb11_02

You are on page 1of 36

Feedback

Control Systems

BE(EL)

Lecturer

Electrical Engg.Department( NED UET)

Objective:

The objective of this session is to learn how to represent

polynomials in MATLAB,

o Find roots of polynomials,

o create polynomials when roots are known and

o Obtain partial fractions.

Polynomial Overview:

MATLAB provides functions for standard polynomial operations, such as

polynomial roots, evaluation, and differentiation. In addition, there are functions

for more advanced applications, such as curve fitting and partial fraction

expansion.

Representing Polynomials

MATLAB represents polynomials as row vectors containing coefficients ordered by

descending powers. For example, consider the equation

>> p = [1 0 -2 -5];

Polynomial Roots

The roots function calculates the roots of a polynomial:

By convention, MATLAB stores roots in column

>> r = roots(p) vectors.

2.0946

r=

-1.0473 + 1.1359i

-1.0473 - 1.1359i

o The function poly returns to the polynomial coefficients:

>> p2 = poly(r)

p2 =

1 0 -2 -5

Polynomial Evaluation

o The polyval function evaluates a polynomial at a specified value.

o To evaluate p at s = 5, use

>> polyval(p,5)

ans =

110

Convolution and Deconvolution

Polynomial multiplication and division correspond to the operations convolution

and deconvolution.

o The functions conv and deconv implement these operations.

o Consider the polynomials a(s )=s2+2s+3 and b(s )=4s2+5s+6 .

o To compute their product,

>> a = [1 2 3];

>> b = [4 5 6];

>> c = conv(a,b)

c=

4 13 28 27 18

o Use deconvolution to divide back out of the product:

>>[q,r] = deconv(c,a)

q=

4 5 6 b = [4 5 6];

r=

0 0 0 0 0

Polynomial Derivatives

The polyder function computes the derivative of any polynomial.

o To obtain the derivative of the polynomial.

>>p= [1 0 -2 -5]

>>q = polyder(p)

q=

3 0 -2

polyder also computes the derivative of the product or quotient of two polynomials.

o For example, create two polynomials a and b:

>>a = [1 3 5];

>>b = [2 4 6];

Calculate the derivative of the product a*b by calling polyder with a single output argument:

>>c = polyder(a,b)

c=

8 30 56 38

Transfer Function

• Transfer Function is the ratio of Laplace transform of the

output to the Laplace transform of the input. Consider all initial

conditions to zero.

u(t) y(t)

Plant

If u ( t ) U ( S ) and

y(t ) Y ( S )

8

Transfer Function

• The transfer function G(S) of the plant is given as

Y (S )

G( S )

U (S )

9

Why Laplace Transform?

• Using Laplace transform, we can convert many

common functions into algebraic function of complex

variable s.

• For example

sin t 2

s 2

at 1

e

sa

• Where s is a complex variable (complex frequency) and

is given as 10

s j

Partial Fraction Expansion

‘residue’ finds the partial fraction expansion of the ratio of two polynomials.

This is particularly useful for applications that represent systems in transfer function form.

For polynomials b and a,

p is a column vector of pole locations, and

k is a row vector of direct terms.

>>b = [-4 8]; r= p=

>>a = [1 6 8]; k=

-12 -4

>>[r,p,k] = residue(b,a) []

8 -2

Transfer Function

Objective:

The objective of this session is:

o Partial Fraction Expansion,

o Transfer Function Representation

o Pole-Zero location of a Transfer Function

1.1. Obtain the partial fractions of the function F(s) = (s + 1)/ (s2 + s + 1).

close all;

clear all;

clc;

b=[1 1];

a=[1 1 1];

[r,p,k]=residue(b,a) %It finds the residues, pole and direct terms of a partial fraction expan

r=

0.5000 - 0.2887i

0.5000 + 0.2887i

p=

-0.5000 + 0.8660i

-0.5000 - 0.8660i

k=

[]

1.2. Define the following transfer function G(S) in MATLAB. G(s) = s (s + 1)

(s + 2) / s (s + 3) (s2 + 4s + 8).

close all;

clear all;

clc;

num=[1 3 2];

den=[1 7 20 24 0];

sys=tf(num,den) %generates the transfer function with the given numerator num and denominator den.

Transfer function:

s^3 + 3s^2 +2s

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

S^4 + 7 s^3 + 20 s^2 + 24 s

1.3. Find the location of the zeros, poles and plot the pole-zero map of the system,

whose transfer function given by;

F(s) = (2s2 + 8s + 6) / (s4 + 6s3 + 12s2 + 24s)

close all;

clear all;

clc;

num=[0 0 2 8 6];

den=[1 6 12 24 0];

[z,p,k]=tf2zp(num,den) % generates the poles, zeros and gain

The result of the command is; The result specifies that the zeros are at s=-3 and -1, the poles are at

s=0, -4.5198, -0.7401 + 2.1822i and

s=-0.7401 - 2.1822i

and the gain is k=2.

k=

2 z = -3 -1 p = 0 -4.5198 -0.7401 + 2.1822i -0.7401 - 2.1822i

Pole-zero map for this function can be obtained by using the following command.

pzmap(num,den)

1.4) Verify the results obtained for example 1.3 by obtaining the transfer function from the calculated

values of zeros, poles and gain.

close all;

clear all;

clc;

z=[-3; -1];

p=[0; -4.5198; -0.7401 + 2.1822i; -0.7401 - 2.1822i];

k=2;

[n,d]=zp2tf(z,p,k);

printsys(n,d,'s') % prints the transfer function as a ratio of two polynomials in the transform variable 's'. The result of

the command is

1.5. Find the Laplace transform of the function

f (t) =e-t (1-sin (t))

clear all;

close all;

clc;

syms t %define the function f(t)

ft=exp(-t)*(1-sin(t));

fs=laplace(ft)

1.6) Find the inverse Laplace transform of the function F(s) =1/(s + 4).

clear all;

close all;

clc;

syms s t %construct symbolic objects for Laplace transform variable 's' and time variable 't'.

fs=1/(s+4);

ft=ilaplace(fs)

The result of the command is;

ft =

1/exp(4*t)

Exercise 1:

Consider the two polynomials p(s)=s2+2s+1 and q(s)=s+1 .

Use MATLAB to compute

a. p(s )*q(s)

b. Roots of p(s) and q(s)

c. p(-1 ) and q(6)

Exercise 2:

Use MATLAB command to find the partial fraction of the following

a.

b.

Use MATLAB to generate the first 100 terms in the sequence a(n) define recursively by

a(n+1) = p*a(n)*(1-a(n))

with p=2.9 and a(1) = 0.5.

LAB SESSION 2

OBJECTIVE

MATLAB

SIMPLE MASS-SPRING SYSTEM

According to the laws of kinematics

Where

Differential equation for above system can be written as

Equation (1)

where

‘B’ is called the friction coefficient and ‘K’ is called the spring constant.

The linear differential equation of second order (2) describes the relationship between the

Displacement and the Applied Force.

The differential equation can then be used to study the time behavior of x(t) under various changes

of the applied force.

In reality, the spring force and/or the friction force can have a more complicated expression or

could be represented by a graph or data table

a nonlinear spring can be designed

In such case, Equation (1) becomes

Equation (2)

Equation (2) represents another possible model that describes the dynamic behavior of the mass-damper

system under external force.

-Model (2) is said to be nonlinear.

-homogeneity and

-superposition.

SOLVING THE DIFFERENTIAL EQUATION USING MATLAB:

The objectives behind modeling the mass-damper system can be many and may include

Studying the effect of each parameter on the system such as

•Mass M,

•Friction coefficient B, and

•Elastic characteristic Fs(x).

The solution of the difference equations (1), or (2) leads to finding x(t) subject to certain initial conditions.

MATLAB can help to solve linear or nonlinear ordinary differential equations (ODE).

We first see how can we solve first order ODE and

Second how can we solve equation (1) or (2).

SPEED CRUISE CONTROL EXAMPLE:

Assume the spring force Fs(x) =0 which means that K=0. Equation (1) becomes

Equation (3)

Or

Equation (4)

USING MATLAB SOLVER ode45

function dvdt=cruise_speed(t,v)

M=750;

B=30;

Fa=300;

dvdt=Fa/M-B/M*v; %dv/dt=(Fa/M)-(B/M)v

create a new MATLAB m-file and write

v0=0;% (initial speed)

[t,v]=ode45('cruise_speed',[0 200],v0);

plot(t,v);

grid on;

title('cruise speed time response to a constant fraction force Fa(t)')

parameters defined in function, observe the variation &

comment.

Assume the spring force Fs(x) = k xr(t). The mass-spring damper is now equivalent to

The second order differential equation has to be decomposed in a set of first order differential equations as

follows

In vector form, let

create a MATLAB-function mass_spring.m

function dXdt=mass_spring(t,X)

M=750; % (Kg)

B=15; % (Nsec/m)

Fa=300; % (N)

K=15; % (N/m)

r=1; % dX/dt

dXdt(1,1)=X(2);

dXdt(2,1)=-B/M*X(2)-K/M*X(1)^r+Fa/M;

1.When r=1 (Linear model )

clear all; close all; clc;

X0=[0;0];

[t,X]=ode45('mass_spring',[0 200],X0);

figure;

plot(t,X(:,1));

xlabel('Time(t)');

ylabel('Position');

title('Mass spring system');

legend('Position '); grid;

figure;

plot(t,X(:,2),'r');

xlabel('Time(t)'); ylabel('Speed');

title('Mass spring system');

legend('Speed ');

grid;

2.When r=2 (Nonlinear Model)

Write the same code as above by varying the value of r

POST LAB TASK

Plot the position and the speed in separate graphs by using the codes used in lab procedure.

2. Change the value of r to 2 and 3.

3. Superpose the results and compare with the linear case r=1 and plot all three cases in the same plot window. Use

different figures for velocity and displacement.

4. Change the values of each parameters, such as

Mass M,

Friction coefficient B, and

Elastic characteristic k.

Compare the results and describe the effects.

- (5) Material Balance as an Equation of Straight LineUploaded bymangerbang_m
- Algebraic Equation SolverUploaded byRam Singh
- Topic 02 - Polynomials - Features.docUploaded byJessica Nguyen
- 10 MergedUploaded byvsavadi
- Ws EliminationUploaded byNick Hershman
- 2010_10_lyp_mathematics_sa1_03Uploaded byHarish Kumar
- Acet - Syllabus 1_facUploaded byMadhurima Maggu
- Advanced Coupling Matrix Synthesis Technique for UW FiltersUploaded byFlorin Calinescu
- Files 2 Lectures Lec19Uploaded bySai Swaroop Mandal
- parent child activity ryenUploaded byapi-255372522
- Cameron 2003Uploaded byDo Son
- Grade 9 DLL Quarter 1Uploaded byroy raluto
- vxcvdccdUploaded byGrendel Cooper
- 4th Quadratics & Algebra.pdfUploaded byHema Bhaskar
- Ecuación_diferencialUploaded byJunior Caña Pinto
- activity_1_sometimes_always_never.pdfUploaded byCésar Augusto
- c 0352017022Uploaded byInternational Journal of computational Engineering research (IJCER)
- IUploaded byLouis Tian
- حل معادلات درجه ۲و۳و۴.xlsUploaded bysaital
- iwwwfb11_02Uploaded bypbandyk
- Partialderivatives TopologyUploaded byWill Black
- indiana algebra standardsUploaded byapi-246223718
- Finite FieldsUploaded byMaloy Ghosh
- Maths Question PapersUploaded bygcobane
- MAT 100 W4 Clsdsc.doc-3Uploaded byThalia Sanders
- A Discourse on Conceptual Understanding and Best PracticesUploaded byKay Thoms
- Factoring PolynomialsUploaded byjay harold
- wikyUploaded byAndres Monteria
- 95CF51A4-ECBB-4B08-86EC-637DC89F2FF5Uploaded bysrivastava1984rahul
- ch 1 part 1 reviewUploaded byapi-253582032

- Multivariable Calculus 1Uploaded bymuhammad
- 8.5x11greySquareMultiUploaded bymuhammad
- LAB N0 9.docxUploaded bymuhammad
- Practical 3 - Final.docxUploaded bymuhammad
- Practical 1 - Final.docxUploaded bymuhammad
- Practical 3 - FinalUploaded bymuhammad
- Practical 1 - Final.docxUploaded bymuhammad
- MODELING A DC MOTOR.docxUploaded bymuhammad
- Presentation1.pptxUploaded bymuhammad
- Practical 1 - FinalUploaded bymuhammad
- AskUploaded bymuhammad
- LAB N0 9.docxUploaded bymuhammad
- LAB N0 9Uploaded bymuhammad
- . Boiler and Power Plant Me 336Uploaded bymuhammad
- PID1.txtUploaded bymuhammad
- FCS LAB-1 ppt.pptxUploaded bymuhammad

- igcse higher tier revision listUploaded byapi-196286744
- Introduction to LPPUploaded bysubhi1980
- Integral Transform Techniques for Green s FunctionUploaded byKaique Dantas
- Cimg TutorialUploaded bypeterhaijin
- Solution AssignUploaded byLobhabati Panda
- SyntheticUploaded byccs1953
- g8m5l1- concept of a functionUploaded byapi-276774049
- dsumUploaded bysd_hosseini_88
- chapter 6 software engineeringUploaded byk_suganthivasu
- lklkUploaded bySarthak Gupta
- MODELING HEALTH - Part I Theory of Modes of Health V.03Uploaded byNaomar Almeida-Filho
- 2013-05-13 Rational Functions 1Uploaded bySam Shah
- Fourier Transforms_ An Introduction for Engineers (1995).pdfUploaded byMoises Gamaliel Lopez Arias
- Steps for MM Pricing ProceduresUploaded byashish sawant
- bungie barbie engineering labUploaded byapi-240376735
- College Algebra 8Uploaded byEm
- The ML BookUploaded byfioan89
- NEFIS User ManualUploaded byAnonymous K02Ehz
- hp39gs-manual.pdfUploaded byMatheus Paes Peçanha
- MathematicsUploaded bySaqib Rehan
- Theory of StatisticsUploaded byLe Tung
- IMAGINE Users ManualUploaded byManish Narkhede
- LimitesUploaded byRuben
- A Survey of Methods and Strategies in Character SegmentationUploaded byjamilhaider
- ACL 9 Quick GuideUploaded byEmmanuel Zama
- Exercises for Workgroup 1-5Uploaded byAlessandro Caiazzo
- Marvin Minsky, Seymour a. Papert - Perceptrons_ an Introduction to Computational Geometry (1987, The MIT Press)Uploaded byBerkay Özerbay
- MA1200 Chapter 6 Limits, Continuity and DifferentiabilityUploaded byWai Ho Choi
- Analysis of Additional Mathematics SPM Papers(1)Uploaded byJeremy Ling
- Trial 2 SMK Bandaraya KK(Questions)_1Uploaded bylingboo