arrayfun works well for this:
arrayfun(@(x) 1/(1+e^(-x)), [0, 1; 2, 3])
Output:
ans =
0.50000 0.73106
0.88080 0.95257
This basically runs function 1/(1+e^(-x)) on each element of the matrix/vector.
arrayfun works well for this:
arrayfun(@(x) 1/(1+e^(-x)), [0, 1; 2, 3])
Output:
ans =
0.50000 0.73106
0.88080 0.95257
This basically runs function 1/(1+e^(-x)) on each element of the matrix/vector.