Please how can I writ this function in Matlab

1 次查看(过去 30 天)
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

回答(1 个)

Torsten
Torsten 2023-4-27
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

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by