-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproblem1.m
44 lines (43 loc) · 1.24 KB
/
problem1.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
function [] = problem1()
disp('--------------------------------------------------------------------------------------------------problem 1_a-------------------------------------------')
cvx_begin
variables x1 x2
minimize(x1 +x2)
subject to
-2*x1 - x2 <= 0
-x1 - 3*x2 <= -1
-x1 <= 0
-x2 <= 0
%norm (x,Inf) <= e
cvx_end
x1
x2
disp('##########################################################################################')
disp('----------------------------------------------------------------------------------------------problem 1_b-------------------------------------------')
cvx_begin
variables x1 x2
minimize(norm ([ x1 ; x2 ],Inf))
subject to
-2*x1 - x2 <= 0
-x1 - 3*x2 <= -1
-x1 <= 0
-x2 <= 0
%norm (x,Inf) <= e
cvx_end
x1
x2
disp('##########################################################################################')
disp('----------------------------------------------------------------------------------------------problem 1_c-------------------------------------------')
cvx_begin
variables x1 x2
minimize(x1^2+9*x2^2)
subject to
-2*x1 - x2 <= 0
-x1 - 3*x2 <= -1
-x1 <= 0
-x2 <= 0
%norm (x,Inf) <= e
cvx_end
x1
x2
end