Commit e6bb33a4 authored by Kristian Soltesz's avatar Kristian Soltesz
Browse files

code clean

parent c199e80e
......@@ -84,30 +84,45 @@ K = minreal(K(p));
% Constraints and gradients
function [c,cEq,c_p,cEq_p]=cNL(p)
% Sensitivity
if Ms < inf
Sw = fr(S(p));
Sm = abs(Sw);
cS = Sm-Ms;
Sm_p = -mdot(Sm,real(mdot(Sw.*Pw,K_pw(p))));
else
cS = [];
Sm_p = [];
end
% Complementary sensitivity
if Mt < inf
Tw = 1-Sw;
Tm = abs(Tw);
cT = Tm-Mt;
Tm_p = mdot(Tm,real(mdot(Sw.^2.*Pw./Tw,K_pw(p))));
else
cT = [];
Tm_p = [];
end
% Noise sensitivity
if Mks < inf
Kw = fr(C(p)*F(p));
Km = abs(Kw);
KSm = Km.*Sm*c0; % Undo regularization
cKS = KSm-Mks;
KSm_p = mdot(Sm./Km,real(mdot(conj(Kw).*Sw,K_pw(p))));
else
cKS = [];
KSm_p = [];
end
% Constraints
c = [cS cT cKS];
cEq = [];
% Gradients
Sm_p = -mdot(Sm,real(mdot(Sw.*Pw,K_pw(p))));
Tm_p = mdot(Tm,real(mdot(Sw.^2.*Pw./Tw,K_pw(p))));
Qm_p = mdot(Sm./Km,real(mdot(conj(Kw).*Sw,K_pw(p))));
c_p = [Sm_p;Tm_p;Qm_p].';
c_p = [Sm_p;Tm_p;KSm_p].';
cEq_p = [];
end
end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment