Sie sind auf Seite 1von 11

LAB 4: LEARNING SYSTEM IDENTIFICATION

TOOLBOX OF MATLAB

ENGR 446: CONTROL SYSTEM

San Francisco State University


School of Science & Engineering

Instructor: Jonathan Song

AUGUST 3, 2019

By Dovido Djantio
1. INTRODUCTION

System Identification Toolbox provides MATLAB​ ​functions, Simulink​®​ blocks, and an app for
constructing mathematical models of dynamic systems from measured input-output data. It lets
you create and use models of dynamic systems not easily modeled from first principles or
specifications. You can use time-domain and frequency-domain input-output data to identify
continuous-time and discrete-time transfer functions, process models, and state-space models.
The toolbox also provides algorithms for embedded online parameter estimation.
The toolbox provides identification techniques such as maximum likelihood, prediction-error
minimization (PEM), and subspace system identification. To represent nonlinear system
dynamics, you can estimate Hammerstein-Wiener models and nonlinear ARX models with
wavelet network, tree-partition, and sigmoid network nonlinearities. The toolbox performs
grey-box system identification for estimating parameters of a user-defined model. You can
use the identified model for system response prediction and plant modeling in Simulink. The
toolbox also supports time-series data modeling and time-series forecasting.

2. PROBLEM DEFINITION
System identification is a methodology for building mathematical models of dynamic systems
using measurements of the system’s input and output signals.

The process of system identification requires that you:

Measure the input and output signals from your system in time or frequency domain.

Select a model structure

Apply an estimation method to estimate value for the adjustable parameters in the candidate
model structure.

Evaluate the estimated model to see if the model is adequate for your application needs​.
System identification uses the input and output signals you measure from a system to estimate
the values of adjustable parameters in a given model structure.

Obtaining a good model of your system depends on how well your measured data reflects the
behavior of the system.

3. A BRIEF EXPLANATION OF THE EXPERIMENTS

First we will Importing data into the MATLAB® workspace.we will do it by pasting the file
Measured_Time_Input_Output.mat into the workspace. We will represent the data in the System
Identification as an datain and dataout object in the MATLAB workspace. To achieve it we will
enter the following scripts in the command window of matlab.

Signals
Signals.Time
Signals.Data
totaltime = Signals.Time(:,:)
datain = Signals.Data(:,1)
dataout = Signals.Data(:,2)

Then we will plot data to examine both time- and frequency-domain behavior.
The next step will be to find the sampling time signal. We will achieve it by entering it in the
command window of matlab.
To estimate the transfer function of our system, in the System Identification app,
select ​Estimate​ > ​Transfer Function Models, ​the Transfer Functions dialog box opens. In the
Number of poles​ and ​Number of zeros​ fields, specify the number of poles and zeros of the
transfer function as non negative integers. 0 poles and 3 zeros will give us 100% accuracy for our
system. Then select ​Continuous-time​ or ​Discrete-time​ to specify whether the model is a
continuous- or discrete-time transfer function.
To find the stated state model of the system, we will go in the System Identification app, select
Estimate​ > ​State Space Models​ to open the State Space Models dialog box. In model order the
specify value will be 3. This will give us 100% accuracy for our model

4. MODELS / CALCULATIONS / SIMULATIONS RESULTS


​Plot of datain and dataout
In command windows we will type:
plot(Signals.Time, Signals.Data)
Find the sample time from the Time signal

To find it in the command window we will enter the following script

samplingtime = Signals.Time(2,1) - Signals.Time(1,1)

samplingtime =

0.0500

Find the best transfer function that can explain the system.

In the system identification apps, after importing the data in it, we will select 3 poles and 0 zeros
This will give you 100% accuracy.
Status:​Estimated using TFEST
Fit to estimation data: ​100%​, FPE: 1.4244e-10

>> tf1

tf1 =

From input "u1" to output "y1":


9.997
------------------------------
s^3 + 20.99 s^2 + 11 s + 9.997

Name: tf1
Continuous-time identified transfer function.

Parameterization:
Number of poles: 3 Number of zeros: 0
Number of free coefficients: 4
Use "tfdata", "getpvec", "getcov" for parameters and their uncertainties.
The transfer function is :
9.997
s3 +20.99s2 +9.997

Let ‘s plot our system with our new transfer function


plot(totaltime, lsim(tf1, datain, totaltime))
Find the stated state model of the system.

With a model order of 3 we will get a fit estimation data of 100%


Let’s export the the new state space model to the workspace

>> ss1

ss1 =
Continuous-time identified state-space model:
dx/dt = A x(t) + B u(t) + K e(t)
y(t) = C x(t) + D u(t) + e(t)

A=
x1 x2 x3
x1 -15.28 1.608 7.401
x2 -0.4364 -0.01551 -0.4238
x3 14.85 -0.4916 -7.931

B=
u1
x1 -3.417
x2 -0.07708
x3 3.292

C=
x1 x2 x3
y1 -3.738 7.249 -3.709

D=
u1
y1 0

K=
y1
x1 14.16
x2 1.16
x3 -17.46

Name: ss1
Parameterization:
FREE form (all coefficients in A, B, C free).
Feedthrough: none
Disturbance component: estimate
Number of free coefficients: 18
Use "idssdata", "getpvec", "getcov" for parameters and their uncertainties.

Status:
Estimated using N4SID on time domain data "mydata".
Fit to estimation data: 100% (prediction focus)
FPE: 6.767e-30, MSE: 6.502e-30
Plot the new state space model

>> plot(totaltime, lsim(ss1, datain, totaltime))

Compare the output the system you are given with the response of the transfer function
and States pace model when exposed to the given input.

The 2 outputs are perfectly identical.


Use the LTI viewer to find the response of the identified system to unit step and impulse.

Plot of Step response

Plot of impulse response


CONCLUSION

Constructing models from observed data is a fundamental element in science. Several


methodologies and nomenclatures have been developed in different application areas. In the
control area, the techniques are known under the term System Identification.

System identification uses the input and output signals you measure from a system to estimate
the values of adjustable parameters in a given model structure.

Obtaining a good model of your system depends on how well your measured data reflects the
behavior of the system.

Das könnte Ihnen auch gefallen