-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselectExample.m
executable file
·61 lines (61 loc) · 2.03 KB
/
selectExample.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
%function [Ai,Bi,x0] = selectExampleRamos(n,qsi)
function [Ai,Bi,x0,sigmas] = selectExample(varargin)
n = varargin{1};
qsi = 0.5;
if nargin == 2
qsi = varargin{2};
elseif nargin>2
error('Error. Maximum inputs exceeded');
end
load('sigmasExamples.mat');
if (n == 1)
% Example 1
A{1} = [0 1 0;0 0 1;0.0341 -0.2571 0.7769]*qsi;
A{2} = [0 1 0;0 0 1;-0.0341 -0.2571 -0.7769]*qsi;
Bi{1} = [1;0;0];
Bi{2} = Bi{1};
K = [10 10 10];
Ai{1} = A{1} - Bi{1}*K;
Ai{2} = A{2} - Bi{2}*K;
x0 = [0.3;-0.8;0.64]*100;
sigmas = sigmasEx1;
elseif (n == 2)
% Example 2
A{1} = [-0.7970 0.1023 0.2392 -0.5628 0.4539;
-0.0932 -0.2959 0.7038 -0.2135 -0.4529;
0.4761 -0.8786 -0.6605 -0.3839 -0.6531;
-0.4290 -0.5883 0.0009 0.4510 0.5222;
-0.0270 0.1544 -0.4358 -0.4583 0.1025]*qsi;
A{2} = [0.1204 -0.4321 -0.5430 -0.5713 -0.2579;
-0.5015 -0.0582 1.0519 -0.2097 -0.1361;
-0.2760 -0.4405 -0.0192 -0.3769 -0.0696;
-0.4404 -0.5706 0.0106 0.4511 0.5311;
-0.8047 0.6074 0.2272 -0.4511 0.7059]*qsi;
A{3} = [-0.128 0.0280 -0.3349 -0.4249 0.1838;
-0.3909 -0.2629 0.9593 -0.2749 -0.3327;
-0.0724 -0.8177 -0.1899 -0.4970 -0.4317;
-0.4373 -0.5763 0.0080 0.4492 0.5256;
-0.5941 0.2174 0.0508 -0.5753 0.3315]*qsi;
A{4} = [-0.3178 -0.2082 -0.1487 -0.6306 0.02049;
-0.3065 -0.1578 -0.8764 -0.1834 -0.2619;
0.0832 -0.6240 -0.3425 -0.3238 -0.3014;
-0.4350 -0.5734 0.0057 0.4518 0.5275;
-0.4332 0.4177 -0.107 -0.4009 0.4662]*qsi;
Bi = cell(1,length(A));
Ai = cell(1,length(A));
K = [10 10 10 10 10];
x0 = [0.3;-0.8;0.64;-0.03;0.01]*10;
sigmas = sigmasEx2;
for i=1:length(A)
Bi{i} = zeros(length(A{1}),1);
Bi{i}(1) = 1;
Bi{i}(3) = 1;
Ai{i} = A{i} - Bi{i}*K;
end
elseif (n == 3)
thetas = [0 1];
[Ai,Bi] = pandeySS([-qsi qsi],thetas);
x0 = [0.3;-0.8;0.64;-0.03];
sigmas = sigmasEx3;
end
end