-
Notifications
You must be signed in to change notification settings - Fork 0
/
controle.m
34 lines (31 loc) · 899 Bytes
/
controle.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
function U=controle(t,X,region,Foguete)
% Função que calcula o controle beta de atitude do foguete
% global betai
%
opt=2;
if opt==1
beta_range=[-pi pi];
func=@(beta) fun(beta,t,X,region,Foguete);
gradfunc=@(beta) gradfun(beta,t,X,region,Foguete);
condc=@(beta) cond(beta,t,X,region,Foguete);
betai=1.2;
beta=secTCond(func,gradfunc,condc,beta_range,betai);
% betai=beta;
elseif opt==2
beta_range=[-pi pi];
func=@(beta) fun(beta,t,X,region,Foguete);
gradfunc=@(beta) gradfun(beta,t,X,region,Foguete);
grad2func=@(beta) grad2fun(beta,t,X,region,Foguete);
condc=@(beta) cond(beta,t,X,region,Foguete);
betai=1.2;
beta=step2bCond(func,gradfunc,grad2func,condc,beta_range,betai);
% betai=beta;
elseif opt==3
beta=funaprox(X);
end
U=beta;
end
function f=funaprox(X)
lu=X(8); lv=X(9);
f=atan2(-lu,-lv);
end