%AD_CVER is a script that implements analog-to-digital (A/D) conversion using Tank-Hopfield net

% Written by S. H. Zak on May 29, 1999


%disp('=======================================================')

v_0=0:0.01:1;
v_1=0:0.01:1;
[V_0,V_1]=meshgrid(v_0,v_1);
E=(1/2)*(2*V_1+V_0-1.5).^2;
subplot(2,2,1)
mesh(V_0,V_1,E)
%view(-25,80)
set(gca, 'box', 'on');
xlabel('{\it V}_0')
ylabel('{\it V}_1')
title('(a)---Plot of the "simple" cost function (9.107)')
subplot(2,2,2)
E1=-2*V_1.*(V_1-1)-.5*V_0.*(V_0-1);
mesh(V_0,V_1,E1)
%view(-25,80)
set(gca, 'box', 'on');
xlabel('{\it V}_0')
ylabel('{\it V}_1')
title('(b)---Plot of the term used to cancel quadratic terms in (9.107)')
subplot(2,2,3)
E2=E+E1;
mesh(V_0,V_1,E2)
%view(-25,80)
set(gca, 'box', 'on');
title('(c)---Plot of the "final" cost function (9.109)')
xlabel('{\it V}_0')
ylabel('{\it V}_1')
