Matlab画**函数sigmoid, tanh,Relu等
程序员文章站
2022-05-22 11:19:51
...
x = linspace(-10.0,10.0);
relu = max(x,0);
sigmoid = 1./(1.0+exp(-1.0*x));
tanh = 2./(1.0 + exp(-2.0 * x)) - 1;
plot(x,relu,'r');
hold on;
plot(x,sigmoid,'b');
hold on;
plot(x,tanh,'g');
legend('relu','sigmoid','tanh');
title('**函数(Activation)','FontSize',16);
hold on;
y = linspace(-2.0,5.0);
x = 0.*y;
plot(x,y,'k')
axis([-2.0 5.0 -2.0 5.0])
set(gca, 'XGrid','on'); % X轴的网格
set(gca, 'YGrid','on'); % Y轴的网格
ReLu 与 TLU
x = linspace(-10.0,10.0);
relu = max(x,0);
tlu = max(x-1,0)+1
plot(x,relu,'r');
hold on;
plot(x,tlu,'b');
hold on;
legend('relu','tlu');
title('**函数(Activation)','FontSize',16);
hold on;
y = linspace(-2.0,5.0);
x = 0.*y;
plot(x,y,'k')
axis([-2.0 5.0 -2.0 5.0])
set(gca, 'XGrid','on'); % X轴的网格
set(gca, 'YGrid','on'); % Y轴的网格
上一篇: SV---接口