The variational formulation that you need to specify in the file Bistable.m is given by
u*v*dx + k*0.01*du'*dv*dx
for the left-hand side and
k*w(2)*(1 - w(2)*w(2))*v*dx + w(1)*v*dx
for the right-hand side.
The fixed-point iteration can be implemented as follows:
while 1
% Assemble vector
b = AssembleVector(p, e, t, 'Bistable', [U0 U1], time);
% Solve the linear system
newU1 = A \ b;
% Check if the solution has converged
if norm(newU1 - U1) < 0.01
break;
end
% Update U1 to new value
U1 = newU1;
end