rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
porsche_circle_x3opt_y3opt_r20_get_grad_eq_constr.m
1 function grad_eq_constr = porsche_circle_x3opt_y3opt_r20_get_grad_eq_constr(model)
2 %function grad_eq_constr = porsche_get_grad_eq_constr(mu,z)
3 %
4 % DOKU SCHREIBEN!!!
5 %
6 % Oliver Zeeb, 31.05.2011
7 
8 % old: nur x3 und y3 als paramter
9 % grad_eq_constr(1) = 2* (model.x3 - model.pmacro(3,1));
10 % grad_eq_constr(2) = 2* (model.y3 - model.pmacro(3,2));
11 
12 % new: beliebig viele punkte (x_n,y_n) als parameter möglich:
13 x_ind_1=0;
14 x_ind_2=-1;
15 y_ind_1=0;
16 y_ind_2=0;
17 grad_eq_constr = zeros(length(model.mu_names)/2, length(model.mu_names));
18 for k=1:length(model.mu_names)
19  position_in_pmacro = str2double(model.mu_names{k}(2));
20  x_or_y = model.mu_names{k}(1);
21  if x_or_y == 'x'
22  x_ind_1 = x_ind_1+1;
23  x_ind_2 = x_ind_2+2;
24  x = getfield(model, model.mu_names{k});
25  x_fix = model.mittelpunkt(1);
26  grad_eq_constr(x_ind_1,x_ind_2) = 2*(x-x_fix);
27  elseif x_or_y == 'y'
28  y_ind_1 = y_ind_1+1;
29  y_ind_2 = y_ind_2+2;
30  y = getfield(model, model.mu_names{k});
31  y_fix = model.mittelpunkt(2);
32  grad_eq_constr(y_ind_1,y_ind_2) = 2*(y-y_fix);
33  else
34  error('unknown entry in model.mu_names');
35  end
36 end