It looks like you are running a loop. Follow like shown below:
N = 100; % loop count
Er = zeros(1,N) ;
for i = 1:N
Xei_1 = Xe(i);
Er(i) = abs((Xei - Xei_1)/Xei_1)*100;% calculating Relative Error
end
plot(1:N,Er)
Also you can vectorise the lines depending on what your code is.
