A PHP Error was encountered

Severity: Warning

Message: fopen(/home/polpe/.phpsession/ci_session8a2f3092a10ef831c02b2be34ebc4dc08dfff9a8): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 159

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

Polcz Péter honlapja

Tartalomjegyzék

Embedding

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

File: embedding.m
Directory: 4_gyujtemegy/11_CCS/_2_nonlin-pannon/2018
Author: Peter Polcz (ppolcz@gmail.com)
Created on 2018. July 23.

Embedding into QP

syms t x1 x2 p1 p2 p3 real

x = [x1 ; x2];
p = [p1 ; p2 ; p3];

f_sym = [
    -1 / (x1^2 + 2*x2 + 3)
    1 / (x2 + x1)
    ];

g_sym = [
    2
    -1 / x2
    ];

h_sym = 1 / x2;
\begin{align} {\LARGE(67) \quad} f(x) = \left(\begin{array}{c} -\frac{1}{x_{1}^2+2x_{2}+3} \\ \frac{1}{x_{1}+x_{2}} \\ \end{array}\right) \end{align} \begin{align} {\LARGE(68) \quad} g(x) = \left(\begin{array}{c} 2 \\ -\frac{1}{x_{2}} \\ \end{array}\right) \end{align} \begin{align} {\LARGE(69) \quad} h(x) = \frac{1}{x_{2}} \end{align}
p_def = [
    1/x2
    1/(x1+x2)
    1/(x1^2 + 2*x2 + 3)
    ];

fp_sym = subs(f_sym, p_def, p);
gp_sym = subs(g_sym, p_def, p);

F_sym = [
    fp_sym
    subs(jacobian(p_def, x)*fp_sym, p_def, p)
    ];

G_sym = [
    gp_sym
    subs(jacobian(p_def, x)*gp_sym, p_def, p)
    ];

H_sym = subs(h_sym, p_def, p);
\begin{align} {\LARGE(70) \quad} f(x,p) = \left(\begin{array}{c} -p_{3} \\ p_{2} \\ -p_{1}^2p_{2} \\ p_{2}^2p_{3}-p_{2}^3 \\ 2p_{3}^3x_{1}-2p_{2}p_{3}^2 \\ \end{array}\right) \end{align} \begin{align} {\LARGE(71) \quad} g(x,p) = \left(\begin{array}{c} 2 \\ -p_{1} \\ p_{1}^3 \\ p_{1}p_{2}^2-2p_{2}^2 \\ 2p_{1}p_{3}^2-4p_{3}^2x_{1} \\ \end{array}\right) \end{align} \begin{align} {\LARGE(72) \quad} h(x,p) = p_{1} \end{align}

Simulate the rational model (before embedding)

u0 = 1;
x0 = [
    0
    -1.15
    ];

f_fh = matlabFunction(f_sym + u0*g_sym, 'vars', {t x});

figure('Position', [ 605 , 351 , 486 , 364 ], 'Color', [1 1 1])
[tt,xx] = ode45(f_fh, [0,10], x0);
plot(tt,xx(:,[1 2])), grid on;
title 'Simulation of the original system ($x_1$, $x_2$)' interpreter latex

Simulate the polynomial system (after embedding)

z = [x;p];
z_def = subs(z,p,p_def);
z_fh = matlabFunction(z_def, 'vars', {x});

z0 = z_fh(x0);

F_fh = matlabFunction(F_sym + u0*G_sym, 'vars', {t z});
[tt,xx] = ode45(F_fh, [0,10], z0);

figure('Position', [ 529 , 351 , 1124 , 355 ], 'Color', [1 1 1])

subplot(121)
plot(tt,xx(:,[1 2])), grid on;
title 'Simulation of the embedding system ($x_1$, $x_2$)' interpreter latex

subplot(122)
plot(tt,xx(:,[3 4 5])), grid on;
title 'Simulation of the embedding system ($p_1$, $p_2$, $p_3$)' interpreter latex