close all
clear all

Vq = 0:32767;
Vd = 0;

Target = 700;

M2 = Vq.^2+Vd.^2;
M = M2.^.5;

Delta = Target-M;

Delta2 = Delta.^2;

Delta2Approx = Target.^2-M2;


figure
subplot(3,1,1)
plot(Vq,M);
hold all
plot(Vq,Delta);


subplot(3,1,2)
plot(Vq,Delta2);
hold all
plot(Vq,Delta2Approx);
legend('Delta^2','Delta2Approx');


subplot(3,1,3)
plot(Vq,Delta);
hold all
plot(Vq,bitshift(cast(Delta2Approx,'int32'),-16));
legend('Delta^2','Delta2Approx');
