Revision 1436, 0.8 kB
(checked in by vahalam, 13 years ago)
|
pridani a uprava lqg s hyperstavem viz clanek Kim2006
|
Line | |
---|
1 | function [cdu] = comps(i)
|
---|
2 |
|
---|
3 | a = [0,10,50,100,200,300,500,1000; 0,1,1.8,2.4,3.2,3.8,4.8,6.8];
|
---|
4 | a(1,:)=a(1,:)/500;
|
---|
5 | a(2,:)=a(2,:)*1.1;
|
---|
6 |
|
---|
7 | k = zeros(7,1);
|
---|
8 | for l = 1:7,
|
---|
9 | k(l) = (a(2,l+1) - a(2,l))/(a(1,l+1) - a(1,l));
|
---|
10 | end
|
---|
11 |
|
---|
12 | si = sign(i);
|
---|
13 | i = abs(i);
|
---|
14 |
|
---|
15 | if(i < a(1,2))
|
---|
16 | du = k(1)*i;
|
---|
17 | elseif(i < a(1,3))
|
---|
18 | du = k(2)*(i-a(1,2)) + a(2,2);
|
---|
19 | elseif(i < a(1,4))
|
---|
20 | du = k(3)*(i-a(1,3)) + a(2,3);
|
---|
21 | elseif(i < a(1,5))
|
---|
22 | du = k(4)*(i-a(1,4)) + a(2,4);
|
---|
23 | elseif(i < a(1,6))
|
---|
24 | du = k(5)*(i-a(1,5)) + a(2,5);
|
---|
25 | elseif(i < a(1,7))
|
---|
26 | du = k(6)*(i-a(1,6)) + a(2,6);
|
---|
27 | else
|
---|
28 | du = k(7)*(i - a(1,7)) + a(2,7);
|
---|
29 | end
|
---|
30 |
|
---|
31 | if (du < 0)
|
---|
32 | du = 0;
|
---|
33 | end
|
---|
34 |
|
---|
35 | cdu = si*du;
|
---|
36 | end |
---|