Please how can I writ this function in Matlab
Show older comments
A1=det(V33);
B1=det(V44);
C1=det(V34);
D1=det(V3_4);
%eigvalues
Delta=A1+B1+2*C1;
nup=sqrt(Delta+sqrt(Delta.^2-4.*det(V3_4)))./sqrt(2);
nun=sqrt(Delta-sqrt(Delta.^2-4.*det(V3_4)))./sqrt(2);
fmp=(nup+1)/2*log((nup+1)/2)-(nup-1)/2*log((nup-1)/2);
fmn=(nun+1)/2*log((nun+1)/2)-(nun-1)/2*log((nun-1)/2);
fB1=(sqrt(B1)+1)/2*log((sqrt(B1)+1)/2)-(sqrt(B1)-1)/2*log((sqrt(B1)-1)/2);
Dg1=fB1-fmp-fmn;
%inf epsilon
G1=(2*C1^2+(B1-1)*(D1-A1)+2*abs(C1)*sqrt(C1^2+(-1+B1)*(-A1+D1)))/(B1-1)^2;%val1
G2=(A1*B1-C1^2+D1-sqrt(C1^4+(-A1*B1+D1)^2-2*C1*(A1*B1+D1)))/2*B1;%val2
G3=(D1-A1*B1)^2-(1+B1)*C1^2*(A1+D1);%<=0 condition
DgG1=(sqrt(G1)+1)/2*log((sqrt(G1)+1)/2)-(sqrt(G1)-1)/2*log((sqrt(G1)-1)/2);
DgG2=(sqrt(G2)+1)/2*log((sqrt(G2)+1)/2)-(sqrt(G2)-1)/2*log((sqrt(G2)-1)/2);
if G3 <= 0
Dg = real(DgG1+Dg1);
else
Dg = real(DgG2+Dg1);
end

Answers (1)
Torsten
on 27 Apr 2023
if (D-A*B)^2<=(1+B)*C^2*(A+D)
E_min = (2*C^2+(-1+B)*(-A+D)+2*abs(C)*sqrt(C^2+(-1+B)*(-A+D)))/(-1+B)^2;
else
E_min = (A*B-C^2+D-sqrt(C^4+(-A*B+D)^2-2*C^2*(A*B+D)))/(2*B);
end
Categories
Find more on MATLAB Report Generator in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!