mengchaoheng / qcat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

## About
This source code come from [Ola Härkegård](http://research.harkegard.se/). and the default readme is `/QCAT/README`, the doc of lib is [here](http://research.harkegard.se/qcat/index.html) or `/QCAT/doc/`, the code is in `/QCAT/qcat/`. Thanks to [Ola Härkegård](http://research.harkegard.se/) for his excellent work in getting us such a powerful library.

## Test 
We used this project as a library in the [control_allocation project](https://github.com/mengchaoheng/control_allocation) and wrote several test files to learn the use of this library. Run the `test_qcatxxx` of the [control_allocation project](https://github.com/mengchaoheng/control_allocation) to view the usage.
## Change log

1. Add this `readme.md`.

2. fix bug, here is the output of `git diff`:
```sh
diff --git a/QCAT/qcat/alloc_sim.m b/QCAT/qcat/alloc_sim.m
index c31bc19..90b752e 100644
--- a/QCAT/qcat/alloc_sim.m
+++ b/QCAT/qcat/alloc_sim.m
@@ -56,7 +56,7 @@
   Wi   = zeros(m,1); % initial working set
   Wv   = eye(k);     % QP allocation
   Wu   = eye(m);
-  ud   = zeros(m,1);
+  ud   = zeros(m);
   W1   = eye(m);     % Dynamic allocation
   W2   = zeros(m);
   S    = pinv(B);
diff --git a/QCAT/qcat/cgi_alloc.m b/QCAT/qcat/cgi_alloc.m
index 97a0d4c..0099bd5 100644
--- a/QCAT/qcat/cgi_alloc.m
+++ b/QCAT/qcat/cgi_alloc.m
@@ -60,7 +60,7 @@
   % If the preceeding pseudoinverse solution yielded some variables
   % infeasible, redistribute the control effect to the remaining free
   % variables, if there are any.
-  while any([i_min ; i_max]) && any(i_free) && (iter<imax)
+  while any([i_min ; i_max]) & any(i_free) & (iter<imax);
     iter = iter + 1;
     % Now solve for optimal values of the remaining free variables.
     % See 2002-02-07.
@@ -71,8 +71,7 @@
     A = Wv*B1/Wu11;
     b = Wv*(v-B*u-B1*(Wu11\(Wu1*(ud-u))));
     % Solve for optimal perturbation.
-    % p1 = Wu11\(pinv_sol(A,b)+Wu1*(ud-u));
-    p1 = Wu11\(pinv(A)*b+Wu1*(ud-u));
+    p1 = Wu11\(pinv_sol(A,b)+Wu1*(ud-u));
     % Update solution
     u(i_free) = u(i_free) + p1;
     
diff --git a/QCAT/qcat/dir_alloc.m b/QCAT/qcat/dir_alloc.m
index b11eb57..5cc70e0 100644
--- a/QCAT/qcat/dir_alloc.m
+++ b/QCAT/qcat/dir_alloc.m
@@ -51,7 +51,7 @@
   
   % Solve linear program
   options = optimset('Display', 'off');
-  x = linprog(f,A,b,Aeq,beq,lb,ub,options); % update: delete [] for x0 error.
+  x = linprog(f,A,b,Aeq,beq,lb,ub,[],options);
   a = x(1);
   u = x(2:end);
   

```

About

License:BSD 2-Clause "Simplified" License


Languages

Language:HTML 74.3%Language:MATLAB 20.4%Language:C 4.7%Language:CSS 0.7%