rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
DefaultModel.m
1 classdef DefaultModel < ARE.Model
2 % DEFAULTMODEL
3 %
4 % This class represents a simple model which can be used for prototyping
5 % ARE equations.
6 % You can set up a new model by passing a descr structure, which should
7 % contain information about all the data matrices.
8 %
9 % Note that the data matrices for Q,R and E have default values and are
10 % set to identity matrices with the correct dimensions by default.
11 %
12 % Andreas Schmidt, 2016
13 
14  properties
15  descr;
16 
17  mu = [];
18  mu_names = {};
19  mu_ranges = {};
20  end
21 
22  methods
23  function this = DefaultModel(descr)
24  this.descr = descr;0
25 
26  if ~isfield(descr, 'p'), descr.p = size(descr.C_comp{1},1); end
27  if ~isfield(descr, 'm'), descr.m = size(descr.B_comp{1},2); end
28 
29  this.p = descr.p;
30  this.m = descr.m;
31  this.n = descr.n;
32  this.mu = descr.mu;
33 
34  if ~isfield(descr,'mu_ranges') || ~isfield(descr,'mu_names')
35  error('Please provide valid values for mu_ranges and mu_names');
36  end
37 
38  this.mu_names = descr.mu_names;
39  this.mu_ranges = descr.mu_ranges;
40  end
41 
42  function A = A_coeff(this)
43  A = this.descr.A_coeff(this);
44  end
45  function A = A_comp(this, md)
46  A = this.descr.A_comp;
47  end
48  function B = B_coeff(this)
49  B = this.descr.B_coeff(this);
50  end
51  function B = B_comp(this, md)
52  B = this.descr.B_comp;
53  end
54  function C = C_coeff(this)
55  C = this.descr.C_coeff(this);
56  end
57  function C = C_comp(this, md)
58  C = this.descr.C_comp;
59  end
60 
61  function E = E_coeff(this)
62  if isfield(this.descr, 'E_coeff')
63  E = this.descr.E_coeff(this);
64  else
65  E = E_coeff@ARE.Model(this);
66  end
67  end
68  function E = E_comp(this,md)
69  if isfield(this.descr, 'E_comp')
70  E = this.descr.E_comp;
71  else
72  E = E_comp@ARE.Model(this);
73  end
74  end
75 
76  function Q = Q_coeff(this)
77  if isfield(this.descr, 'Q_coeff')
78  Q = this.descr.Q_coeff(this);
79  else
80  Q = Q_coeff@ARE.Model(this);
81  end
82  end
83  function Q = Q_comp(this,md)
84  if isfield(this.descr, 'Q_comp')
85  Q = this.descr.Q_comp;
86  else
87  Q = Q_comp@ARE.Model(this);
88  end
89  end
90 
91  function R = R_coeff(this)
92  if isfield(this.descr, 'R_coeff')
93  R = this.descr.R_coeff(this);
94  else
95  R = R_coeff@ARE.Model(this);
96  end
97  end
98  function R = R_comp(this,md)
99  if isfield(this.descr, 'R_comp')
100  R = this.descr.R_comp;
101  else
102  R = R_comp@ARE.Model(this);
103  end
104  end
105 
106 
107  end
108 end
MODEL Class that defines the assemble method which is used by both, the DetailedModel and the Reduced...
Definition: Model.m:18
Implementation of the parametric algebraic Riccati equation.