Tartalomjegyzék

Simulate Example 1. of 2016_Bobiti.Lazar

Teljes Matlab script kiegészítő függvényekkel.

File: d2018_01_20_ex1_sim.m
Directory: projects/2_sta/2018_01_20_2016_Bobiti.Lazar
Author: Peter Polcz (ppolcz@gmail.com)
Created on 2018. January 20.

Simulate a discrete-time dynamical system

syms x1 x2 real
x = [x1;x2];

It is given the following discrete-time (possibly nonlinear) dynamical system:

$$ x[k+1] = G\big(x[k]\big), \text{ with } x[k] \in \mathbb{R}^n. $$

Let $n = 2$, and $G(x)$ be given as follows [1]:

G = [
    x1/2 + x1^2 - x2^2
    -x2/2 + x1^2
    ];
\begin{align} G(x) = \left(\begin{array}{c} {x_{1}}^2+\frac{x_{1}}{2}-{x_{2}}^2 \\ {x_{1}}^2-\frac{x_{2}}{2} \\ \end{array}\right) \end{align}
G_fh = matlabFunction(G, 'vars', {x});

[xx1,xx2] = meshgrid(linspace(-0.1,0.1,4));

figure, hold on
for i = 1:numel(xx1)
    xx = simulate(G_fh, [xx1(i); xx2(i)], 10);
    P = plot(xx(:,1), xx(:,2),'.-');
    plot(xx(1,1), xx(1,2), '*', 'Color', P.Color);
end

function x = simulate(G, x0, N)
    x = zeros(N,numel(x0));
    x(1,:) = x0';

    xi = x0;
    for i = 2:N
        xi = G(xi);
        x(i,:) = xi';
    end
end

References

[1] Bobiti, R. & Lazar, M. A sampling approach to finding Lyapunov functions for nonlinear discrete-time systems. 2016 European Control Conference (ECC), 2016, pg. 561-566