Julia, are you showing all the code? Looks like the variable a is not defined.
As for the plot command: one of the round brackets is misplaced. The way it is typed right now, MATLAB thinks that the command ends after the 2.
plot(k,log(norm(r))^2) /(dot(p,A*p));