You are on page 1of 21

UNIVERSIDAD DE LA SALLE

LABORATORIO 1 SISTEMAS DE CONTROL


Mateo Vinchira 45171071, David espinosa 45171005, Camilo Suaza 45171076
CREACIÓN DE MODELOS

El propósito de este laboratorio es familiarizar al estudiante con la plataforma de programación Math


Lab, con el fin de que al momento de que en el desarrollo del curso el estudiante conozca todas las
herramientas que tiene a su alcance de tal manera que se le facilite la modelación o simulación de
sistemas de control.

Como primera actividad de familiarización con el programa se realizo una lectura donde se recomienda
el uso de algunas funciones del Tool box y la creación de variables y vectores.

numero = 2

numero = 2

vector = [ 1 2 3]

vector =
1 2 3
Comprobación del valor del vector

vector = [4 5 6]

vector =
4 5 6
Mediante el uso de la función help para cd se puede obtener una explicación detallada de como llamar la
función en el programa y su correspondiente acción luego de escribirla en el programa, así mismo para
las funciones : dir, roots, poly, conv y control.

help cd

cd Change current working directory.


cd directory-spec sets the current directory to the one specified.
cd .. moves to the directory above the current one.
cd, by itself, prints out the current directory.

WD = cd returns the current directory as a string.

Use the functional form of cd, such as cd('directory-spec'),


when the directory specification is stored in a string.

See also pwd.

Reference page for cd


Other functions named cd

help dir

dir List folder.


dir NAME lists the files in a folder. Pathnames and
asterisk wildcards may be used. A single asterisk in the path touching
only file separators will represent exactly one folder name. A
single asterisk at the end of an input will represent any filename. An
asterisk followed or preceded by characters will resolve to zero or
more characters. A double asterisk can only be used in the path and
will represent zero or more folder names. It cannot touch a character
other than a file separator. For example, dir *.m lists all files with
a .m extension in the current folder. dir */*.m lists all files with
a .m extension exactly one folder under the current folder.
dir **/*.m lists all files with a .m extension zero or more
folders under the current folder.

D = dir('NAME') returns the results in an M-by-1


structure with the fields:
name -- Filename
folder -- Absolute path
date -- Modification date
bytes -- Number of bytes allocated to the file
isdir -- 1 if name is a folder and 0 if not
datenum -- Modification date as a MATLAB serial date number.
This value is locale-dependent.

See also what, cd, type, delete, ls, rmdir, mkdir, datenum.

Reference page for dir


Other functions named dir

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.

Reference page for roots


Other functions named roots

help poly

poly Convert roots to polynomial.


poly(A), when A is an N by N matrix, is a row vector
with N+1 elements which are the coefficients of the
characteristic polynomial, det(lambda*eye(size(A)) - A).

poly(V), when V is a vector, is a vector whose elements are


the coefficients of the polynomial whose roots are the
elements of V. For vectors, ROOTS and poly are inverse
functions of each other, up to ordering, scaling, and
roundoff error.

Examples:

roots(poly(1:20)) generates Wilkinson's famous example.

Class support for inputs A,V:


float: double, single

See also roots, conv, residue, polyval.

Reference page for poly


Other functions named poly

help conv

conv Convolution and polynomial multiplication.


C = conv(A, B) convolves vectors A and B. The resulting vector is length
MAX([LENGTH(A)+LENGTH(B)-1,LENGTH(A),LENGTH(B)]). If A and B are vectors of
polynomial coefficients, convolving them is equivalent to
multiplying the two polynomials.

C = conv(A, B, SHAPE) returns a subsection of the convolution with


size specified by SHAPE:
'full' - (default) returns the full convolution,
'same' - returns the central part of the convolution
that is the same size as A.
'valid' - returns only those parts of the convolution that
are computed without the zero-padded edges.
LENGTH(C)is MAX(LENGTH(A)-MAX(0,LENGTH(B)-1),0).

Class support for inputs A,B:


float: double, single

See also deconv, conv2, convn, filter, xcorr, convmtx.

Note: XCORR and CONVMTX are in the Signal Processing Toolbox.

Reference page for conv


Other functions named conv

vector = [6 7 8]

vector =
6 7 8

help control

Control System Toolbox


Version 10.3 (R2017b) 24-Jul-2017

Table of Contents
-----------------
Modeling - Create and combine models of linear systems
Analysis - Analyze systems in the time or frequency domain
Design - Design and tune control systems
Plotting - Create and customize response plots
General - Preferences, linear algebra utilities
Apps - Control System Toolbox apps
Examples - Control System Toolbox examples

num = [1 0]

num =
1 0

den = [1 2 10]

den =
1 2 10

H=tf(num,den)

H =

s
--------------
s^2 + 2 s + 10

3
Continuous-time transfer function.

z=[ ]

z =

[]

p = [ 2 1+i 1-i]

p =
2.0000 + 0.0000i 1.0000 + 1.0000i 1.0000 - 1.0000i

k=[ -2 ]

k = -2

G=zpk(z,p,k)

G =

-2
--------------------
(s-2) (s^2 - 2s + 2)

Continuous-time zero/pole/gain model.

help tfdata

--- help for DynamicSystem/tfdata ---

tfdata Quick access to transfer function data.

[NUM,DEN] = tfdata(SYS) returns the numerator(s) and denominator(s)


of the transfer function SYS. For a transfer function with NY
outputs and NU inputs, NUM and DEN are NY-by-NU cell arrays where
the (I,J) entry specifies the transfer function from input J to
output I. SYS is first converted to transfer function if necessary.

[NUM,DEN,TS] = tfdata(SYS) also returns the sample time TS. Other


properties of SYS can be accessed using struct-like dot syntax
(for example, SYS.ioDelay).

[NUM,DEN,TS,SDNUM,SDDEN] = tfdata(SYS) also returns the uncertainties


in the numerator and denominator coefficients of identified system SYS.
SDNUM{i,j}(k) is the 1 std uncertainty in the value NUM{i,j}(k) and
SDDEN{i,j}(k) is the 1 std uncertainty in the value DEN{i,j}(k). If SYS
does not contain uncertainty information, SDNUM and SDDEN are [].

For a single SISO model SYS, the syntax


[NUM,DEN] = tfdata(SYS,'v')
returns the numerator and denominator as row vectors rather
than cell arrays.

[NUM,DEN,TS,...] = tfdata(SYS,J1,...,JN) extracts the data for


the (J1,...,JN) entry in the model array SYS.

4
See also tf, zpkdata, ssdata, idtf.

help zpkdata

--- help for DynamicSystem/zpkdata ---

zpkdata Quick access to zero-pole-gain data.

[Z,P,K] = zpkdata(SYS) returns the zeros, poles, and gain for each
I/O channel of the dynamic system SYS. The cell arrays Z,P and the
matrix K have as many rows as outputs and as many columns as inputs,
and their (I,J) entries specify the zeros, poles, and gain of the
transfer function from input J to output I. SYS is first converted
to zero-pole-gain format if necessary.

[Z,P,K,TS] = zpkdata(SYS) also returns the sample time TS. Other


properties of SYS can be accessed using struct-like dot syntax
(for example, SYS.Variable).

[Z,P,K,TS,COVZ,COVP,COVK] = zpkdata(SYS) also returns the covariances


of the zeros, poles and gain of the identified model SYS. COVZ is a
cell array such that COVZ{ky,ku} contains the covariance information
about the zeros in the vector Z{ky,ku}. COVZ{ky,ku} is a 3-D array of
dimension 2-by-2-by-Nz, where Nz is the length of Z{ky,ku}, so that
the (1,1) element is the variance of the real part, the (2,2) element
is the variance of the imaginary part, and the (1,2) and (2,1)
elements contain the covariance between the real and imaginary parts.
COVP has a similar relationship to P. COVK is a matrix containing the
variances of the elements of K.

[n1,d1]=tfdata(H,'v')

n1 =
0 1 0
d1 =
1 2 10

[z1, p1, k1]=zpkdata(H,'v')

z1 = 0
p1 =
-1.0000 + 3.0000i
-1.0000 - 3.0000i
k1 = 1

[n2, d2]=tfdata(G,'v')

n2 =
0 0 0 -2
d2 =
1 -4 6 -4

[z2,p2,k2]=zpkdata(G,'v')

z2 =

0×1 empty double column vector


p2 =

5
2.0000 + 0.0000i
1.0000 + 1.0000i
1.0000 - 1.0000i
k2 = -2

tf(G)

ans =

-2
---------------------
s^3 - 4 s^2 + 6 s - 4

Continuous-time transfer function.

CONEXIÓN DE MODELOS

help series

series Series connection of two input/output models.

+ ------+
v2 --- >| |
+ ------+ | M2 |-----> y2
| |------- >| |
u1 ----- >| |y1 u2 + ------+
| M1 |
| |--- > z1
+ ------+

M = series(M1,M2,OUTPUTS1,INPUTS2) connects the input/ouput


models M1 and M2 in series. The vectors of indices OUTPUTS1 and
INPUTS2 specify which outputs of M1 and which inputs of M2 are
connected together. The resulting model M maps u1 to y2.

If OUTPUTS1 and INPUTS2 are omitted, series connects M1 and


M2 in cascade and returns M = M2 * M1.

If M1 and M2 are arrays of models, series returns a model array M


of the same size where
M(:,:,k) = series(M1(:,:,k),M2(:,:,k),OUTPUTS1,INPUTS2) .

For dynamic systems SYS1 and SYS2,


SYS = series(SYS1,SYS2,'name')
connects SYS1 and SYS2 by matching their I/O names. The output
names of SYS1 and input names of SYS2 should be fully defined.

See also append, parallel, feedback, InputOutputModel, DynamicSystem.

Reference page for series


Other functions named series

help parallel

Parallel Algorithms

Distributed Array Functions


distributed - construct from local data
isdistributed - return true for distributed arrays

6
gather - retrieve data from the labs to the client
classUnderlying - return the class of the elements
isaUnderlying - return true if elements are of a given class

distributed.cell - build distributed cell array


distributed.colon - build distributed vector of form a:[d:]b
distributed.eye - build distributed identity matrix
distributed.false - build distributed array containing 'false'
distributed.inf - build distributed array containing 'Inf'
distributed.linspace - build distributed vector of linearly equally spaced values
distributed.logspace - build distributed vector of logarithmically equally spaced values
distributed.nan - build distributed array containing 'NaN'
distributed.ones - build distributed array containing ones
distributed.rand - build distributed array containing rand
distributed.randi - build distributed array containing randi
distributed.randn - build distributed array containing randn
distributed.spalloc - build empty sparse distributed array
distributed.speye - build sparse distributed identity matrix
distributed.sprand - build sparse distributed array containing rand
distributed.sprandn - build sparse distributed array containing randn
distributed.true - build distributed array containing 'true'
distributed.zeros - build distributed array containing zeros%

dload - Load distributed arrays and composite objects


from disk
dsave - Save workspace distributed arrays and composite
objects to disk

Codistributed Array Functions


codistributed - Create a codistributed array from replicated
data
codistributed.build - Create a codistributed array from local parts
that can be different on each lab
codistributed/gather - Convert a codistributed array into a
replicated or variant array
codistributed/getLocalPart - Local portion of a codistributed array
codistributed/globalIndices - Global indices of local part of a
codistributed array
codistributed/redistribute - Redistribute a codistributed array with
another codistributor

codistributor1d - Distribution scheme that partitions


array in a single specified dimension
codistributor1d/Dimension - Distributed dimension of codistributor
codistributor1d/Partition - Partition of a 1d codistributor
codistributor1d.defaultPartition - Default partition in 1d for a
codistributed array

General Parallel Functions


gop - Apply a global operation across all labs
gcat - Apply global concatenation across all labs
gplus - Apply global addition across all labs

spmd - Single Program Multiple Data block allows


more control over distributed arrays by
providing access to them as codistributed
arrays within the block
labindex - Return the ID for this lab
numlabs - Return the number of labs operating in
parallel
mapreduce - Solve out-of-memory problems with the MapReduce framework.

Parallel Communication Functions


labSend - Send data to another lab
labReceive - Receive data from another lab

7
labSendReceive - Simultaneously send to and receive from other
labs
labBroadcast - Send data to all labs
labBarrier - Block until all labs have entered the barrier
labProbe - Test to see if messages are ready to labReceive
mpiLibConf - Location of MPI implementation
mpiSettings - Set various options for MPI communication

See also distcomp, distributed, spmd, codistributed, codistributor1d, mapreduce.

parallel is both a directory and a function.

parallel Parallel connection of two input/output models.

+------ +
v1 ---------- >| |---------- > z1
| M1 |
u1 +-- >| |---+ y1
| +------ + |
u ------>+ O------ > y
| +------ + |
u2 +-- >| |---+ y2
| M2 |
v2 ---------- >| |---------- > z2
+------ +

M = parallel(M1,M2,IN1,IN2,OUT1,OUT2) connects the input/output models


M1 and M2 in parallel. The inputs specified by IN1 and IN2 are
connected and the outputs specified by OUT1 and OUT2 are summed. The
resulting model M maps [v1;u;v2] to [z1;y;z2]. The vectors IN1 and IN2
contain indices into the input vectors of M1 and M2, respectively, and
define the input channels u1 and u2 in the diagram. Similarly, the
vectors OUT1 and OUT2 contain indexes into the outputs of M1 and M2.

If IN1,IN2,OUT1,OUT2 are jointly omitted, parallel forms the standard


parallel interconnection of M1 and M2 and returns M = M1 + M2.

If M1 and M2 are arrays of models, parallel returns a model array M


of the same size where
M(:,:,k) = parallel(M1(:,:,k),M2(:,:,k),IN1,...) .

For dynamic systems SYS1 and SYS2,


SYS = parallel(SYS1,SYS2,'name')
connects SYS1 and SYS2 by matching their I/O names. All I/O names of
SYS1 and SYS2 must be defined and the matching names appear in SYS
in the same order as in SYS1.

See also append, series, feedback, InputOutputModel, DynamicSystem.

Reference page for parallel


Other functions named parallel

help feedback

feedback Feedback connection of two input/output systems.

M = feedback(M1,M2) computes a closed-loop model M for the feedback loop:

u --- >O---- >[ M1 ]----+--- > y


| | y = M * u
+----- [ M2 ]<---+

Negative feedback is assumed and the model M maps u to y. To apply

8
positive feedback, use the syntax M = feedback(M1,M2,+1).

M = feedback(M1,M2,FEEDIN,FEEDOUT,SIGN) builds the more general


feedback interconnection:

+------ +
v --------- >| |-------- > z
| M1 |
u --->O---- >| |---- +--- > y
| +------ + |
| |
+----- [ M2 ]<--- +

The vector FEEDIN contains indices into the input vector of M1 and
specifies which inputs u are involved in the feedback loop. Similarly,
FEEDOUT specifies which outputs y of M1 are used for feedback. If
SIGN=1 then positive feedback is used. If SIGN=-1 or SIGN is omitted,
then negative feedback is used. In all cases, the resulting model M has
the same inputs and outputs as M1 (with their order preserved).

If M1 and M2 are arrays of models, feedback returns a model array M


of the same dimensions where
M(:,:,k) = feedback(M1(:,:,k),M2(:,:,k)) .

For dynamic systems SYS1 and SYS2,


SYS = feedback(SYS1,SYS2,'name')
connects SYS1 and SYS2 by matching their I/O names. The I/O names
of SYS1 and SYS2 must be fully defined.

See also lft, parallel, series, connect, InputOutputModel, DynamicSystem.

Reference page for feedback


Other functions named feedback

parallel (H,G)

ans =

(s-3.851) (s+1.088) (s^2 - 1.237s + 4.772)


------------------------------------------
(s-2) (s^2 - 2s + 2) (s^2 + 2s + 10)

Continuous-time zero/pole/gain model.

tf(parallel(H,G))

ans =

s^4 - 4 s^3 + 4 s^2 - 8 s - 20


----------------------------------------
s^5 - 2 s^4 + 8 s^3 - 32 s^2 + 52 s - 40

Continuous-time transfer function.

Diagrama M1
feedback(H,series(H,G))

ans =

9
s (s-2) (s^2 - 2s + 2) (s^2 + 2s + 10)
---------------------------------------------------------------------------
(s-2.012) (s^2 - 1.983s + 1.98) (s^2 + 2.2s + 10.17) (s^2 + 1.795s + 9.873)

Continuous-time zero/pole/gain model.

tf(feedback(H,series(H,G)))

ans =

s^6 - 2 s^5 + 8 s^4 - 32 s^3 + 52 s^2 - 40 s


----------------------------------------------------------------------
s^7 - 4.441e-16 s^6 + 14 s^5 - 36 s^4 + 68 s^3 - 258 s^2 + 440 s -

400 Continuous-time transfer function.

DIAGRAMA M1 DIAGRAMA M2
Diagrama M2

series(H,parallel(H,G))

ans =

s (s-3.851) (s+1.088) (s^2 - 1.237s + 4.772)


--------------------------------------------
(s-2) (s^2 - 2s + 2) (s^2 + 2s + 10)^2

Continuous-time zero/pole/gain model.

tf(series(H,parallel(H,G)))

ans =

s^5 - 4 s^4 + 4 s^3 - 8 s^2 - 20 s


----------------------------------------------------------------------
s^7 - 8.882e-16 s^6 + 14 s^5 - 36 s^4 + 68 s^3 - 256 s^2 + 440 s -

400 Continuous-time transfer function.

ANALISIS TEMPORAL DE LOS MODELOS

num=[10 30]; den=[1 2 10]; A = tf(num,den)

A =
10 s + 30
--------------
s^2 + 2 s + 10

Continuous-time transfer function.

num2=2; den2=[1 2]; B = tf(num2,den2)

B =

2
-----
s + 2

10
Continuous-time transfer function.

step(A)
La respuesta al Escalón unitario se puede visualizar en la siguiente imagen donde se puede
evidenciar la amplitud de la señal junto con el tiempo de subida de dicha señal y finalmente su valor
en estado estacionario

impulse(A)

De igual manera se puede obtener el tiempo de restablecimiento junto con la respuesta de pico de la
señal de impulso unitario A
11
pzmap(A)

12
step(B)

Para el modelo B al escalón de impulso unitario se pueden visualizar algunas características como
las del valor pico el tiempo de subida de la señal y su valor en estado estacionario.

impulse(B)

13
pzmap(B)
la ubicación de los polos en 0

14
EJEMPLO DE ANALISIS FISICO

rlc_gui

CASO DE ESTUDIO

En el caso de estudio se pretende relacionar las herramientas del programa con el proyecto de clase
del grupo de esta manera se aplica la teoría desarrollada en clase con un caso de estudio real.

Kpot = 0.318; K=10; K1=100; a=100; Km=2.083; am = 1.71;


Kg=0.1; %Amplificador de Potencia
numAP=K1; denAP=[1 a]; AmpPot=tf(numAP,denAP)
AmpPot =

100
-------
s + 100

Continuous-time transfer function.

%Motor y carga
numMC=Km; denMC=[1 am 0]; Motor=tf(numMC,denMC)

Motor =

2.083
------------
s^2 + 1.71 s

Continuous-time transfer function.


Luego de ingresar los datos se procede a realizar la conexión del modelo basándose en el
diagrama de bloques que indica la configuración de cada bloque y su relación con el siguiente
bloque, dependiendo de su configuración.

S1=series(Kpot,feedback(series(series(series(K,AmpPot),Motor),Kg),Kpot))

S1 =

66.24
-------------------------------
s^3 + 101.7 s^2 + 171 s + 66.24

Continuous-time transfer function.

T1=tf(S1)

T1 =

66.24
-------------------------------
s^3 + 101.7 s^2 + 171 s + 66.24

Continuous-time transfer function.

step(T1)
Luego de simular la anterior ecuación se puede apreciar la respuesta a la señal de entrada.

You might also like