Sunday, April 25, 2021

ANN Activation functions in MATLAB

 


Artificial Neural Network (ANN) is new and emerging research and problem optimization tool now a days, which's very helpful in research at MS and PhD level. MATLAB is best engineering simulation machine tool which replace your hardware for analysis.
So here I am sharing ANN basic concept with photo then I want to share activation function MATLAB code and results.
in above perception (at right hand) diagram f(x) is called activation function which is basically limiting function.
Activation function has some following types with diagrams and coding

1- Binary Uni-polar function:




1.2- Binary Bi-polar function:



2- Piece-wise Linear Uni-polar function: 



2.2- Piece-wise Linear Bi-polar function:



3- Sigmoid Uni-polar function:  




3.2- Sigmoid Bi-polar function:



Now Activation final code where these all functions are called to display all plots together

  1. clc;
  2. clear all;
  3. close all;
  4. a = 6; % alfa for sigmoid function
  5. v = [-1:0.1:1];
  6. [fv1] = Binary_uni(v)
  7. [fv2] = Binary_bi(v)
  8. [fv3] = Piecewise_uni(v)
  9. [fv4] = Piecewise_bi(v)
  10. [fv5] = Sigmoid_uni(v,a)
  11. [fv6] = Sigmoid_bi(v,a)

  12. subplot(2,3,1);
  13. plot(v,fv1)
  14. title('Binary activation Unipolar f')
  15. xlabel('v')
  16. ylabel('f(v)')

  17. subplot(2,3,4);
  18. plot(v,fv2)
  19. title('Binary activation Bipolar f')
  20. xlabel('v')
  21. ylabel('f(v)')

  22. subplot(2,3,2);
  23. plot(v,fv3)
  24. title('Piecewise activation Unipolar f')
  25. xlabel('v')
  26. ylabel('f(v)')

  27. subplot(2,3,5);
  28. plot(v,fv4)
  29. title('Piecewise activation Bipolar f')
  30. xlabel('v')
  31. ylabel('f(v)')

  32. subplot(2,3,3);
  33. plot(v,fv5)
  34. title('Sigmoid activation Unipolar f')
  35. xlabel('v')
  36. ylabel('f(v)')

  37. subplot(2,3,6);
  38. plot(v,fv6)
  39. title('Sigmoid activation Bipolar f')
  40. xlabel('v')
  41. ylabel('f(v)')
Result out:


If you like this post then like and comment

2 comments:
Write comments

I am very thankful for your precious time

Important Artical

Popular Articals

Total Page views in This Month

© 2019-20 Electronics Garage. Designed by Uzma 0101 & Distributed by elektronicsgarage1.blogspot.com