Severity: Warning
Message: fopen(/home/polpe/.phpsession/ci_session6c1466721ad2a29066dcd9323d0430de7df14200): 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
Teljes Matlab script kiegészítő függvényekkel.
File: ccs_nonlin_Van_der_Pol_Lyapunov.m Author: Peter Polcz (ppolcz@gmail.com)
Created on 2018. August 26.
syms t x1 x2 real
x = [
x1
x2
];
mu = 1;
f_sym = [
-x2
x1 - mu*(1 - x1^2)*x2
];
f_ode = matlabFunction(f_sym, 'vars', {t x});
ode45(f_ode, [0 40],[0 2.1719978066864]');
V = x1^2 + x2^2;
dV = jacobian(V,x) * f_sym;
V_fh = matlabFunction(V);
dV_fh = matlabFunction(dV);
[x1_num,x2_num] = meshgrid(linspace(-4,4,100));
V_num = V_fh(x1_num, x2_num);
dV_num = dV_fh(x1_num, x2_num);
figure, hold on, grid on
% Highlight the area where dV is NOT negative
handle = pcolor(x1_num, x2_num, double(dV_num > 0));
set(handle, 'EdgeAlpha', 0, 'FaceAlpha', 0.5);
colormap default
colormap([1 1 1 ; colormap]);
% Plot the contour lines of V
contour(x1_num, x2_num, V_num, [ 0.1 0.2 0.3 linspace(0.5,50,40) ]);
% This is the maximal contour line which lies completely inside the
% admissible zone
[C,h] = contour(x1_num, x2_num, V_num, [1 1], 'LineWidth', 5, 'Color', [0 0.5 0]);
clabel(C,h)
% Plot the true domain of attraction
[tt,xx] = ode45(f_ode, [0 10],[0 2.1719978066864]');
plot(xx(:,1),xx(:,2),'LineWidth',4,'Color',[0.8 0 0])
legend 'Blue area: where d/dt V(x) > 0' ...
'Contour lines of V(x)' ...
'Estimated domain of attraction' ...
'True domain of attraction'
V = 13*x1^2 + 11*x2^2 - 6*x1*x2;
dV = jacobian(V,x) * f_sym;
V_fh = matlabFunction(V);
dV_fh = matlabFunction(dV);
[x1_num,x2_num] = meshgrid(linspace(-4,4,300));
V_num = V_fh(x1_num, x2_num);
dV_num = dV_fh(x1_num, x2_num);
figure, hold on, grid on
% Highlight the area where dV is NOT negative
handle = pcolor(x1_num, x2_num, double(dV_num > 0)*50);
set(handle, 'EdgeAlpha', 0, 'FaceAlpha', 0.5);
colormap default
colormap([1 1 1 ; colormap]);
% Plot the contour lines of V
contour(x1_num, x2_num, V_num, [ 0.1 0.2 0.3 linspace(0.5,700,40) ]);
% This is the maximal contour line which lies completely inside the
% admissible zone
[C,h] = contour(x1_num, x2_num, V_num, [1 1]*20, 'LineWidth', 5, 'Color', [0 0.5 0]);
clabel(C,h)
% Plot the true domain of attraction
[tt,xx] = ode45(f_ode, [0 10],[0 2.1719978066864]');
plot(xx(:,1),xx(:,2),'LineWidth',4,'Color',[0.8 0 0])
legend 'Blue area: where d/dt V(x) > 0' ...
'Contour lines of V(x)' ...
'Estimated domain of attraction' ...
'True domain of attraction'