Monitor scaled states for continuation
function [prob, args1, args2] = monitor_scaled_states(prob, ispolar, m, scales)
args1 = cell(m,1);
args2 = cell(m,1);
if ispolar
for k=1:m
args1{k} = strcat('rho',num2str(k));
args2{k} = strcat('th',num2str(k));
end
parsRData = struct(); parsTHData = struct();
parsRData.scale = scales(1:2:end);
parsTHData.scale = scales(2:2:end);
prob = coco_add_func(prob, 'radius', @scale_pars, parsRData,...
'active', args1(:)', 'uidx', 1:2:2*m-1);
prob = coco_add_func(prob, 'angle', @scale_pars, parsTHData,...
'active', args2(:)', 'uidx', 2:2:2*m);
else
for k=1:m
args1{k} = strcat('Rez',num2str(k));
args2{k} = strcat('Imz',num2str(k));
end
parsReData = struct(); parsImData = struct();
parsReData.scale = scales(1:2:end);
parsImData.scale = scales(2:2:end);
prob = coco_add_func(prob, 'realParts', @scale_pars, parsReData,...
'active', args1(:)', 'uidx', 1:2:2*m-1);
prob = coco_add_func(prob, 'imagParts', @scale_pars, parsImData,...
'active', args2(:)', 'uidx', 2:2:2*m);
end
end
function [data, y] = scale_pars(prob, data, u)
u = u(:);
k = data.scale(:);
y = k.*u;
end