10 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Бие даалт II

1.6
t =[1911, 1921, 1931, 1941, 1951, 1961, 1971, 1981, 1991, 2001];
p =[31555, 33255, 35602, 41997, 41932, 50840, 71479, 87120, 106313, 124355];
x = 1920:5:2010;
y = interp1(t,p,x,'spline');
plot(t,p,'o',x,y)
y = interp1(t,p,2020,'spline')
y
y=
1.1844e+05
y=
1.1844e+05
2.6
c=[2 -5 7 -3 -3];
A=[];
a=[];
B=[3 1 2 -1 4;-1 1 -1 2 -1];
b=[15;-4];
lb=zeros(5,1);
ub=[];
[x fval]=linprog(c,A,a,B,b,lb,ub)
Optimization terminated.
x=
0.2294
0.0000
0.3853
0.0000
3.3853
fval =
-7.0000

3.25
>> c=[-1 0 -1 0 -1];
A=[-1 -2 -3 1 1; -1 1 2 -1 -1];
a=[-6;-5];
B=[];
b=[];
lb=zeros(5,1);
ub=[];
[x, fval]=linprog(c,A,a,B,b,lb,ub);
Exiting: One or more of the residuals, duality gap, or total relative error
has stalled:
the dual appears to be infeasible (and the primal unbounded).
(The primal residual < OptimalityTolerance=1.00e-08.)

4.25
c=[20;72];
A=[5 6; 2 12];
a=[8;3];
B=[];
b=[];
lb=zeros(2,1);
ub=[];
[x fval]=linprog(c,A,a,B,b,lb,ub)
Optimization terminated.
x=
1.0e-15 *
0.9535
0.0026
fval =
1.9257e-14

5.25
c=[1 -3 -1 1 1 ];
A=[2 3 5 0 8];
a=[5];
B=[-1 1 1 0 2; 1 2 3 1 3];
b=[3;6];
lb=zeros(5,1);
ub=[];
[x fval]=linprog(c,A,a,B,b,lb,ub)
Exiting: One or more of the residuals, duality gap, or total relative error
has grown 100000 times greater than its minimum value so far:
the primal appears to be infeasible (and the dual unbounded).
(The dual residual < OptimalityTolerance=1.00e-08.)
x=
0.0000
4.1833
0.0000
1.5936
0.0000
fval =
-10.9562
6.25
function f=myfun(x)
f=(5*x(1)-x(2)-x(3))/(x(1)+x(2)+2*x(3));
A=[0 5 6 1 0];
a=[11];
B=[3 1 1 1 1; 2 -1 3 0 0];
b=[5;4];
lb=zeros(5,1);
ub=[];
[x, fval]=fmincon('myFFF',[1 2 1 3],A,a,B,b,lb,ub);
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the optimality tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x=
0.0000 0.0000 6.8000 0.6000
fval =
9.0000
7.25
function f=myfun(x)
f=-(x(1)^2-3/2*x(2)+6*x(2)+2*x(1)*x(2);
A=[3 4;1 2];
a=[12;2];
B=[];
b=[];
lb=[];
ub=[];
[x fval]=fmincon('myfun',[1 2],A,a,B,b,lb,ub,[])
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the optimality tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x=
-1.0000 -0.3333
fval =
6.3333

8.25
function f=myfun(x)
f=((x(1)*(x(2)^2)*(x(3)^3));
A=[];
a=[];
B=[1 1 1];
b=[12];
lb=[];
ub=[];
[x fval]=fmincon('myfun',[1 2 1],A,a,B,b,lb,ub,[])
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the optimality tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x=
-1.0000 -0.3333 13.3333
fval =
6.3333

9.25
function f=myfun(x)
f=2*x(1)+8*x(1)^2+9*x(2)+3*x(2)^2+10;
A=[];
a=[];
B=[1 1];
b=[199];
lb=[0;0];
ub=[];
[x fval]=fmincon('myfun',[ 2 1],A,a,B,b,lb,ub)
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the optimality tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x=
149.2500 49.7500
fval =
6.0207e+04
10.25
a=[2];
b=[1.1];
x(1)=0.1; x(2)=0.3; x(3)=0.4; x(4)=0.45; x(5)=0.65;
for i=1:5
y(i)=(log(b.^2-(x(i)).^2))./((x(i)).^2-a.^2).^(1./5);
end
y
y=
Columns 1 through 3
0.1118 - 0.0813i 0.0698 - 0.0507i 0.0302 - 0.0219i
Columns 4 through 5
0.0046 - 0.0034i -0.1498 + 0.1088i

16.25
17.25

18.25
19.25
20.25

You might also like