sigmoid函数matlab绘制曲线

clc;
clear all;
%y1 = (2/(1+exp(-a*u1)))-1;
%测试不同的a值曲线的变化
t=-10:0.2:10;
b = 2;
a1 = 1;
a2 = 2;
a3 = 3;
a4 = 4;
a5 = 5;
y1 = (b./(1+exp(-a1*t)))-1;%一个数除以矩阵
y2 = (b./(1+exp(-a2*t)))-1;
y3 = (b./(1+exp(-a3*t)))-1;
y4 = (b./(1+exp(-a4*t)))-1;
y5 = (b./(1+exp(-a5*t)))-1;
%绘制不同的a值得曲线变化
figure(1)
plot(t,y1,'r',t,y2,'--b',t,y3,'g',t,y4,'y',t,y5,'k','linewidth',0.5);
hold on;
grid on;
legend('a=1','a=2','a=3','a=4','a=5','fontsize',5);
% xlabel('矢量号','fontsize',18);
% ylabel('ID电流/A','fontsize',18);
% xlim([1, aa]);
% ylim([1, 2.5]);
title('a值不同的sigmoid曲线')
gtext(' \leftarrow a=1');
gtext(' \leftarrow a=2');
gtext(' \leftarrow a=3');
gtext(' \leftarrow a=4');
gtext(' \leftarrow a=5');

 
  

输出的结果曲线如下

sigmoid函数matlab绘制曲线_第1张图片

你可能感兴趣的:(MATLAB)