function g = sigmoid(z)
%SIGMOID Compute sigmoid functoon
%   J = SIGMOID(z) computes the sigmoid of z.



% You need to return the following variables correctly 
g = zeros(size(z));

% ====================== YOUR CODE HERE ======================
% Instructions: Compute the sigmoid of each value of z (z can be a matrix,
%               vector or scalar).

length(z)

if length(z) == 1,
	
	g = 1/(1+e^-z);

else
	%this is a totally ghetto way to do this i'm sure.
	%there's got to be a better way to do this...
	%rows
	for r=1:size(z,1)
		%columns
		for c=1:size(z,2)
			g(r,c) = 1 - (1 / (1+e^z(r,c)));
		end
	end
end

% =============================================================

end
