⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fun.m

📁 是1-n-1和2-n-1型的基于MATLAB的标准BP算法程序
💻 M
字号:
%'s','s-shape','5*s-shape','gauss1','gauss2','cos','sin+cos'
function y=fun(x,flag,graph)
a=4; b=3;
switch graph
    case 's'
        switch flag
            case 0
                y=x;
            otherwise
                y=1;
        end
    case 's-shape'
        switch flag
            case 0
                y=1./(1+exp(-x));
            otherwise
                y=exp(-x)./(1+exp(-x)).^2;
        end
    case '5*s-shape'
        switch flag
            case 0
                y=10./(1+exp(-x));
            otherwise
                y=10.*exp(-x)./(1+exp(-x)).^2;
        end
    case 'gauss1'
        switch flag
            case 0
                y=exp(-x.^2/a);
            otherwise
                y=-2/a.*x.*exp(-x.^2/a);
        end
    case 'gauss2'
        switch flag
            case 0
                y=b+exp(-x.^2/a);
            otherwise
                y=-2/a.*x.*exp(-x.^2/a);
        end
    case 'cos'
        switch flag
            case 0
                y=cos(x);
            otherwise
                y=-sin(x);
        end
    case 'sin+cos'
        switch flag
            case 0
                y=sin(x)+cos(x);
            otherwise
                y=cos(x)-sin(x);
        end
end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -