-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #54: Added code, added picture of the reachability tube and set
- Loading branch information
1 parent
6eba690
commit d9fc4e0
Showing
4 changed files
with
67 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions
48
products/+elltool/+doc/+snip/s_chapter06_section05_snippet01.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
alpha = 10; | ||
k1 = 50; | ||
k2 = 500; | ||
m1 = 150; | ||
m2 = 100; | ||
L = 5; | ||
g = 9.8; | ||
Jc = 100; | ||
|
||
x1 = 1; | ||
v1 = 0; | ||
theta1 = pi/2; | ||
omega1 = 0; | ||
t1 = 1; | ||
|
||
d = Jc + m2*L^2/4; | ||
% define matrices aMat, bMat, and control bounds uBoundsEllObj: | ||
aMat = [0, 1, 0, 0; 0, -k1/m1, 0, 0; 0, 0, 0, 1; 0, 0, m2*L*g/2/d, -k2*L/d]; | ||
bMat = [0; 1/m1; 0; 0]; | ||
uBoundsEllObj = alpha * ell_unitball(1); | ||
%define disturbance: | ||
gMat = [0; 0; 0; -m2*L*g*pi/4/d]; | ||
vEllObj = ellipsoid(1, 0); %known disturbance | ||
|
||
%linear system | ||
lsys = elltool.linsys.LinSysContinuous(aMat, bMat, uBoundsEllObj,... | ||
gMat, vEllObj); | ||
timeVec = [t1, 0]; | ||
% initial directions (some random vectors in R^4): | ||
dirsMat = [1 0 1 0; 1 -1 0 0; 0 -1 0 1; 1 1 -1 1; -1 1 1 0; -2 0 1 1].'; | ||
% x1EllObj = ellipsoid([x1; v1; theta1; omega1], eps*eye(4)); %known final point | ||
x1EllObj = ellipsoid([x1; v1; theta1; omega1], zeros(4)); %known final point | ||
|
||
|
||
%backward reach set | ||
brsObj = elltool.reach.ReachContinuous(lsys, x1EllObj, dirsMat, timeVec,... | ||
'isRegEnabled', true, 'isJustCheck', false, 'regTol', 1e-4,... | ||
'absTol', 1e-5, 'relTol', 1e-4); | ||
|
||
basisMat = [1 0 0 0; 0 0 1 0].'; % orthogonal basis of (x1, x3) subspace | ||
psObj = brsObj.projection(basisMat); % reach set projection | ||
|
||
% plot projection of reach set internal approximation: | ||
psObj.plotByIa('b'); | ||
|
||
%plot backward reach set approximation at time t=0 | ||
psCutObj = psObj.cut(0); | ||
psCutObj.plotByIa('r'); |