Skip to content

Instantly share code, notes, and snippets.

@mrkz
Last active December 23, 2015 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrkz/6709677 to your computer and use it in GitHub Desktop.
Save mrkz/6709677 to your computer and use it in GitHub Desktop.
Código para graficar función de activacion tipo sigmoidal
#!/usr/bin/env octave
% funcion de activacion -> sigmoidal
function answer = sigmoidal(a, v)
answer = 1 / (1 + exp(-a*v))
return
endfunction
x = linspace(-5,5,10000);
y1 = arrayfun(@(f) sigmoidal(1, f), x);
y2 = arrayfun(@(f) sigmoidal(5, f), x);
y3 = arrayfun(@(f) sigmoidal(10, f), x);
y4 = arrayfun(@(f) sigmoidal(100, f), x);
% sentencias para graficado
figure;
s(1) = subplot(4,1,1);
s(2) = subplot(4,1,2);
s(3) = subplot(4,1,3);
s(4) = subplot(4,1,4);
plot(s(1), x, y1, 'r','LineWidth',1.5);
plot(s(2), x, y2, 'g','LineWidth',1.5);
plot(s(3), x, y3, 'b','LineWidth',1.5);
plot(s(4), x, y4, 'm','LineWidth',1.5);
xlabel('V');
ylabel('Phi(V)');
ylim([-0.2 1.2]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment