matlab绘制mish、relu、swish、elu、sigmoid、tash、LeakyReLU
时间: 2023-08-05 22:07:49 浏览: 499
好的,我可以为您提供一些代码示例来绘制这些激活函数的图像。
1. Mish:
```matlab
x = -10:0.1:10;
y = x.*tanh(log(1+exp(x)));
plot(x,y);
title('Mish function');
```
2. ReLU:
```matlab
x = -10:0.1:10;
y = max(0,x);
plot(x,y);
title('ReLU function');
```
3. Swish:
```matlab
x = -10:0.1:10;
y = x./(1+exp(-x));
plot(x,y);
title('Swish function');
```
4. ELU:
```matlab
x = -10:0.1:10;
alpha = 1;
y = max(alpha*(exp(x)-1),x);
plot(x,y);
title('ELU function');
```
5. Sigmoid:
```matlab
x = -10:0.1:10;
y = 1./(1+exp(-x));
plot(x,y);
title('Sigmoid function');
```
6. Tanh:
```matlab
x = -10:0.1:10;
y = tanh(x);
plot(x,y);
title('Tanh function');
```
7. LeakyReLU:
```matlab
x = -10:0.1:10;
alpha = 0.01;
y = max(alpha*x,x);
plot(x,y);
title('LeakyReLU function');
```
以上是一些示例代码,您可以根据需要进行修改和调整。希望能帮到您!
阅读全文