(1)
function [JJ,grads]=fushang(y)
sum1=0;
sum2=0;
sum=0;%M=length(y)/2;
M=length(y);
Exk=average(y);
for k=1:M
y(k)=y(k)-Exk;
end
for k=1:M
sum1=sum1+log(cosh(y(k)));
sum2=sum2-exp(-y(k)^2/2);
end
Eg1=sum1/M;
Eg2=sum2/M;
JJ=36/(8*3^0.5-9)*(Eg1)^2+1/(2-6/pi)*(Eg2-2/pi^0.5)^2;
for k=1:M
sum=sum+y(k)^4;
end
grads=sum/M;
(2)
function grads=kurt(x)sum=0;
M=length(x);
for k=1:M
sum=sum+x(k)^4;
end
grads=sum/M;
function [JJ,grads]=fushang(y)
sum1=0;
sum2=0;
sum=0;%M=length(y)/2;
M=length(y);
Exk=average(y);
for k=1:M
y(k)=y(k)-Exk;
end
for k=1:M
sum1=sum1+log(cosh(y(k)));
sum2=sum2-exp(-y(k)^2/2);
end
Eg1=sum1/M;
Eg2=sum2/M;
JJ=36/(8*3^0.5-9)*(Eg1)^2+1/(2-6/pi)*(Eg2-2/pi^0.5)^2;
for k=1:M
sum=sum+y(k)^4;
end
grads=sum/M;
(2)
function grads=kurt(x)sum=0;
M=length(x);
for k=1:M
sum=sum+x(k)^4;
end
grads=sum/M;