forked from Github_Repos/cvw
Add MATLAB scripts for PD plot
This commit is contained in:
parent
2b2760f5bd
commit
8e177b02e4
@ -1,17 +1,26 @@
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -lm
|
||||
LIBS =
|
||||
OBJS = disp.o srt4div.o
|
||||
CC = gcc
|
||||
CFLAGS = -lm
|
||||
LIBS =
|
||||
OBJS4 = disp.o srt4div.o
|
||||
OBJS2 = disp.o srt2div.o
|
||||
|
||||
srt4div: $(OBJS)
|
||||
$(CC) -g -O3 -o srt4div $(OBJS) $(CFLAGS)
|
||||
all: srt4div srt2div
|
||||
|
||||
disp.o: disp.h disp.c
|
||||
$(CC) -g -c -o disp.o disp.c $(CFLAGS)
|
||||
$(CC) -g -c -o disp.o disp.c
|
||||
|
||||
srt4div.o: srt4div.c
|
||||
$(CC) -g -c -o srt4div.o srt4div.c $(CFLAGS)
|
||||
$(CC) -g -c -o srt4div.o srt4div.c
|
||||
|
||||
srt2div.o: srt2div.c
|
||||
$(CC) -g -c -o srt2div.o srt2div.c
|
||||
|
||||
srt4div: $(OBJS4)
|
||||
$(CC) -g -O3 -o srt4div $(OBJS4) $(CFLAGS)
|
||||
|
||||
srt2div: $(OBJS2)
|
||||
$(CC) -g -O3 -o srt2div $(OBJS2) $(CFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~
|
||||
|
@ -11,3 +11,20 @@ Note: Add lg(r) extra iterations due to shifting of computed q
|
||||
|
||||
./srt4div 0.68359375 0.76953125 4 10
|
||||
|
||||
r=2
|
||||
X = 0.10011111
|
||||
D = 0.11000101
|
||||
|
||||
X = 159 (9F)
|
||||
D = 197 (C5)
|
||||
|
||||
X = 159/256 = 0.62109375
|
||||
D = 197/256 = 0.76953125
|
||||
|
||||
./srt2div 0.62109375 0.76953125 8 9
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
BIN
pipelined/srt/stine/pd_bad.png
Normal file
BIN
pipelined/srt/stine/pd_bad.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 119 KiB |
BIN
pipelined/srt/stine/pd_cpa.png
Normal file
BIN
pipelined/srt/stine/pd_cpa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 123 KiB |
BIN
pipelined/srt/stine/pd_csa.pdf
Normal file
BIN
pipelined/srt/stine/pd_csa.pdf
Normal file
Binary file not shown.
BIN
pipelined/srt/stine/pd_csa.png
Normal file
BIN
pipelined/srt/stine/pd_csa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 165 KiB |
BIN
pipelined/srt/stine/srt2div
Executable file
BIN
pipelined/srt/stine/srt2div
Executable file
Binary file not shown.
114
pipelined/srt/stine/srt2div.c
Executable file
114
pipelined/srt/stine/srt2div.c
Executable file
@ -0,0 +1,114 @@
|
||||
#include "disp.h"
|
||||
|
||||
// QSLC is for division by recuerrence for
|
||||
// r=2 using a CPA - See 5.109 EL
|
||||
int qst (double D, double prem) {
|
||||
|
||||
int q;
|
||||
|
||||
// For Debugging
|
||||
printf("rw --> %lg\n", prem);
|
||||
|
||||
if (prem >= 0.5) {
|
||||
q = 1;
|
||||
} else if (prem >= -0.5) {
|
||||
q = 0;
|
||||
} else {
|
||||
q = -1;
|
||||
}
|
||||
return q;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
This routine performs a radix-2 SRT division
|
||||
algorithm. The user inputs the numerator, the denominator,
|
||||
and the number of iterations. It assumes that 0.5 <= D < 1.
|
||||
|
||||
*/
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
double P, N, D, Q, RQ, RD, RREM, scale;
|
||||
int q;
|
||||
int num_iter, i;
|
||||
int prec;
|
||||
int radix = 2;
|
||||
|
||||
if (argc < 5) {
|
||||
fprintf(stderr,
|
||||
"Usage: %s numerator denominator num_iterations prec\n",
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
sscanf(argv[1],"%lg", &N);
|
||||
sscanf(argv[2],"%lg", &D);
|
||||
sscanf(argv[3],"%d", &num_iter);
|
||||
sscanf(argv[4],"%d", &prec);
|
||||
// Round to precision
|
||||
N = rne(N, prec);
|
||||
D = rne(D, prec);
|
||||
printf("N = ");
|
||||
disp_bin(N, 3, prec, stdout);
|
||||
printf("\n");
|
||||
printf("D = ");
|
||||
disp_bin(D, 3, prec, stdout);
|
||||
printf("\n");
|
||||
|
||||
Q = 0;
|
||||
P = N * pow(2.0, -log2(radix));
|
||||
printf("N = %lg, D = %lg, N/D = %lg, num_iter = %d \n\n",
|
||||
N, D, N/D, num_iter);
|
||||
for (scale = 1, i = 0; i < num_iter; i++) {
|
||||
scale = scale * pow(2.0, -log2(radix));
|
||||
q = qst(flr(2*D, 1), 2*P);
|
||||
printf("2*W[n] = ");
|
||||
disp_bin(radix*P, 3, prec, stdout);
|
||||
printf("\n");
|
||||
printf("q*D = ");
|
||||
disp_bin(q*D, 3, prec, stdout);
|
||||
printf("\n");
|
||||
printf("W[n+1] = ");
|
||||
disp_bin(P ,3, prec, stdout);
|
||||
printf("\n");
|
||||
// Recurrence
|
||||
P = radix * P - q * D;
|
||||
Q = Q + q*scale;
|
||||
printf("i = %d, q = %d, Q = %1.18lf, W = %1.18lf\n", i, q, Q, P);
|
||||
printf("i = %d, q = %d", i, q);
|
||||
printf(", Q = ");
|
||||
disp_bin(Q, 3, prec, stdout);
|
||||
printf(", W = ");
|
||||
disp_bin(P, 3, prec, stdout);
|
||||
printf("\n\n");
|
||||
}
|
||||
if (P < 0) {
|
||||
Q = Q - scale;
|
||||
P = P + D;
|
||||
printf("\nCorrecting Negative Remainder\n");
|
||||
printf("Q = %1.18lf, W = %1.18lf\n", Q, P);
|
||||
printf("Q = ");
|
||||
disp_bin(Q, 3, prec, stdout);
|
||||
printf(", W = ");
|
||||
disp_bin(P, 3, prec, stdout);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// Output Results
|
||||
RQ = N/D;
|
||||
// Since q_{computed} = q / radix, multiply by radix
|
||||
RD = Q * radix;
|
||||
printf("true = %1.18lf, computed = %1.18lf, \n", RQ, RD);
|
||||
printf("true = ");
|
||||
disp_bin(RQ, 3, prec, stdout);
|
||||
printf(", computed = ");
|
||||
disp_bin(RD, 3, prec, stdout);
|
||||
printf("\n\n");
|
||||
printf("REM = %1.18lf \n", P);
|
||||
printf("REM = ");
|
||||
disp_bin(P, 3, prec, stdout);
|
||||
printf("\n\n");
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
508
pipelined/srt/stine/srt4_pd.m
Normal file
508
pipelined/srt/stine/srt4_pd.m
Normal file
@ -0,0 +1,508 @@
|
||||
%
|
||||
% PD Region for Np = 3; Nd = 4;
|
||||
% w/CPA
|
||||
%
|
||||
% Clear all variables and screen
|
||||
clear
|
||||
clf
|
||||
% Define the number of bits (input Dividend)
|
||||
n = 4;
|
||||
%
|
||||
% Define Divisor Range
|
||||
% Normalized Floating Point [Dmin,Dmax] = [1,2]
|
||||
% Normalized Fixed Point [Dmin, Dmax] =[1/2,1]
|
||||
%
|
||||
Dminimum = 1.0/2;
|
||||
Dmaximum = 2.0/2;
|
||||
% Define an ulp
|
||||
ulp = 2^(-n);
|
||||
% radix = beta
|
||||
beta = 4;
|
||||
% rho = redundancy factor -> SHOULD ALWAYS BE >= THAN 1/2
|
||||
%
|
||||
% SD representations have alpha < beta - 1
|
||||
%
|
||||
% alpha = ceil(beta/2) minimially redundant
|
||||
% alpha = beta -1 maximally redundant (rho = 1)
|
||||
% alpha = (beta-1)/2 nonredundant
|
||||
% alpha > beta - 1 over-redundant
|
||||
%
|
||||
rho = 2/3;
|
||||
% Calculation of max digit set
|
||||
alpha = rho*(beta-1);
|
||||
% Da contains digit set
|
||||
q = [];
|
||||
for i = -alpha:alpha
|
||||
q = [q; i];
|
||||
end
|
||||
% 4r(i-1)/D values
|
||||
hold on
|
||||
% figure(1)
|
||||
grid off
|
||||
for i = 1:length(q)
|
||||
x = -rho+q(i):ulp:rho+q(i);
|
||||
% Plot redundancy (overlap) Positive
|
||||
z = [rho+q(i),rho+q(i)];
|
||||
y = [x(length(x))-q(i),0];
|
||||
% Plot redundancy (overlap) Negative
|
||||
if (i ~= length(q))
|
||||
w = [-rho+q(i+1)-q(i+1),0];
|
||||
u = [-rho+q(i+1),-rho+q(i+1)];
|
||||
% plot(u,w,'b')
|
||||
end
|
||||
% plot(x,x-q(i))
|
||||
% plot(z,y,'r')
|
||||
|
||||
end
|
||||
% title('Robertson Diagram for Radix-4 SRT Divison')
|
||||
|
||||
Np = 3;
|
||||
Nd = 4;
|
||||
Dmin = Dminimum;
|
||||
Dmax = Dmaximum;
|
||||
ulpd = 2^(-Nd);
|
||||
ulpp = 2^(-Np);
|
||||
|
||||
%
|
||||
% Plot Atkins P-D plot
|
||||
% Normalized Floating Point [Dmin,Dmax] = [1,2]
|
||||
% Normalized Fixed Point [Dmin, Dmax] =[1/2,1]
|
||||
%
|
||||
Dmin = Dminimum;
|
||||
Dmax = Dmaximum;
|
||||
for i = 1:length(q)
|
||||
D = Dmin:ulp:Dmax;
|
||||
P1 = (rho+q(i))*D;
|
||||
P2 = (-rho+q(i))*D;
|
||||
hold on
|
||||
p1 = plot(D,P1);
|
||||
p1.Color = '#0000ff';
|
||||
p2 = plot(D,P2);
|
||||
p2.Color = '#ff0000';
|
||||
axis([Dmin Dmax -beta*rho*Dmaximum beta*rho*Dmaximum])
|
||||
xticks(D)
|
||||
p1.LineWidth = 2.0;
|
||||
p2.LineWidth = 2.0;
|
||||
end
|
||||
|
||||
% Let's make x/y axis binary
|
||||
j = [];
|
||||
for i=1:length(D)
|
||||
j = [j disp_bin(D(i), 1, 4)];
|
||||
end
|
||||
yk = [];
|
||||
yk2 = [];
|
||||
for i=-2.5:0.5:2.5;
|
||||
yk = [yk disp_bin(i, 3, 3)];
|
||||
yk2 = [yk2 i];
|
||||
end
|
||||
xtickangle(90)
|
||||
xticklabels(j)
|
||||
yticklabels(yk)
|
||||
|
||||
% Let's draw allow points on PD plot
|
||||
% Positive Portions
|
||||
index = 1;
|
||||
i = 0:ulpp:rho*beta*Dmaximum;
|
||||
for j = Dmin:ulpd:Dmax
|
||||
plot(j*ones(1,length(i)),i,'k')
|
||||
end
|
||||
|
||||
j = Dmin:ulpd:Dmax;
|
||||
for i = 0:ulpp:rho*beta*Dmaximum
|
||||
plot(j,i*ones(length(j)),'k')
|
||||
end
|
||||
|
||||
% Negative Portions
|
||||
index = 1;
|
||||
i = 0:-ulpp:rho*-beta*Dmaximum;
|
||||
for j = Dmin:ulpd:Dmax
|
||||
plot(j*ones(1,length(i)),i,'k')
|
||||
end
|
||||
|
||||
j = Dmin:ulpd:Dmax;
|
||||
for i = 0:-ulpp:-rho*beta*Dmaximum
|
||||
plot(j,i*ones(length(j)),'k')
|
||||
end
|
||||
|
||||
% Labels and Printing
|
||||
xlh = xlabel(['Divisor (d)']);
|
||||
%xlh.FontSize = 18;
|
||||
xlh.Position(2) = xlh.Position(2) - 0.1;
|
||||
ylh = ylabel(['P = 4 \cdot w_i']);
|
||||
ylh.Position(1) = ylh.Position(1)-0.02;
|
||||
%ylh.FontSize = 18;
|
||||
|
||||
% Containment Values (placed manually although not bad)
|
||||
m2 = [3/4 7/8 1.0 1.0 5/4 5/4 5/4 3/2 3/2];
|
||||
m1 = [1/4 1/4 1/4 1/4 1/2 1/2 1/2 1/2 1/2];
|
||||
m0 = [-1/4 -1/4 -1/4 -1/4 -1/2 -1/2 -1/2 -1/2 -1/2];
|
||||
m1b = [-3/4 -7/8 -1 -1 -5/4 -5/4 -5/4 -3/2 -3/2];
|
||||
x2 = Dmin:ulpd:Dmax;
|
||||
s2 = stairs(x2, m2);
|
||||
s2.Color = '#8f08d1';
|
||||
s2.LineWidth = 3.0;
|
||||
%s2.LineStyle = '--';
|
||||
s1 = stairs(x2, m1);
|
||||
s1.Color = '#8f08d1';
|
||||
s1.LineWidth = 3.0;
|
||||
s0 = stairs(x2, m0);
|
||||
s0.Color = '#8f08d1';
|
||||
s0.LineWidth = 3.0;
|
||||
s1b = stairs(x2, m1b);
|
||||
s1b.Color = '#8f08d1';
|
||||
s1b.LineWidth = 3.0;
|
||||
|
||||
% Place manually Quotient (ugh)
|
||||
j = Dmin+ulpd/2:ulpd:Dmax;
|
||||
i = rho*beta*Dmaximum-ulpp*3/4:-ulpp:-rho*beta*Dmaximum;
|
||||
text(j(1), i(1), '2')
|
||||
text(j(1), i(2), '2')
|
||||
text(j(1), i(3), '2')
|
||||
text(j(1), i(4), '2')
|
||||
text(j(1), i(5), '2')
|
||||
text(j(1), i(6), '2')
|
||||
text(j(1), i(7), '2')
|
||||
text(j(1), i(8), '2')
|
||||
text(j(1), i(9), '2')
|
||||
text(j(1), i(10), '2')
|
||||
text(j(1), i(11), '2')
|
||||
text(j(1), i(12), '2')
|
||||
text(j(1), i(13), '2')
|
||||
text(j(1), i(14), '2')
|
||||
text(j(1), i(15), '2')
|
||||
text(j(1), i(16), '1')
|
||||
text(j(1), i(17), '1')
|
||||
text(j(1), i(18), '1')
|
||||
text(j(1), i(19), '1')
|
||||
text(j(1), i(20), '0')
|
||||
text(j(1), i(21), '0')
|
||||
text(j(1), i(22), '0')
|
||||
text(j(1), i(23), '0')
|
||||
text(j(1), i(24), '-1')
|
||||
text(j(1), i(25), '-1')
|
||||
text(j(1), i(26), '-1')
|
||||
text(j(1), i(27), '-1')
|
||||
text(j(1), i(28), '-2')
|
||||
text(j(1), i(29), '-2')
|
||||
text(j(1), i(30), '-2')
|
||||
text(j(1), i(31), '-2')
|
||||
text(j(1), i(32), '-2')
|
||||
text(j(1), i(33), '-2')
|
||||
text(j(1), i(34), '-2')
|
||||
text(j(1), i(35), '-2')
|
||||
text(j(1), i(36), '-2')
|
||||
text(j(1), i(37), '-2')
|
||||
text(j(1), i(38), '-2')
|
||||
text(j(1), i(39), '-2')
|
||||
text(j(1), i(40), '-2')
|
||||
text(j(1), i(41), '-2')
|
||||
text(j(1), i(42), '-2')
|
||||
|
||||
text(j(2), i(1), '2')
|
||||
text(j(2), i(2), '2')
|
||||
text(j(2), i(3), '2')
|
||||
text(j(2), i(4), '2')
|
||||
text(j(2), i(5), '2')
|
||||
text(j(2), i(6), '2')
|
||||
text(j(2), i(7), '2')
|
||||
text(j(2), i(8), '2')
|
||||
text(j(2), i(9), '2')
|
||||
text(j(2), i(10), '2')
|
||||
text(j(2), i(11), '2')
|
||||
text(j(2), i(12), '2')
|
||||
text(j(2), i(13), '2')
|
||||
text(j(2), i(14), '2')
|
||||
text(j(2), i(15), '1')
|
||||
text(j(2), i(16), '1')
|
||||
text(j(2), i(17), '1')
|
||||
text(j(2), i(18), '1')
|
||||
text(j(2), i(19), '1')
|
||||
text(j(2), i(20), '0')
|
||||
text(j(2), i(21), '0')
|
||||
text(j(2), i(22), '0')
|
||||
text(j(2), i(23), '0')
|
||||
text(j(2), i(24), '-1')
|
||||
text(j(2), i(25), '-1')
|
||||
text(j(2), i(26), '-1')
|
||||
text(j(2), i(27), '-1')
|
||||
text(j(2), i(28), '-1')
|
||||
text(j(2), i(29), '-2')
|
||||
text(j(2), i(30), '-2')
|
||||
text(j(2), i(31), '-2')
|
||||
text(j(2), i(32), '-2')
|
||||
text(j(2), i(33), '-2')
|
||||
text(j(2), i(34), '-2')
|
||||
text(j(2), i(35), '-2')
|
||||
text(j(2), i(36), '-2')
|
||||
text(j(2), i(37), '-2')
|
||||
text(j(2), i(38), '-2')
|
||||
text(j(2), i(39), '-2')
|
||||
text(j(2), i(40), '-2')
|
||||
text(j(2), i(41), '-2')
|
||||
text(j(2), i(42), '-2')
|
||||
|
||||
text(j(3), i(1), '2')
|
||||
text(j(3), i(2), '2')
|
||||
text(j(3), i(3), '2')
|
||||
text(j(3), i(4), '2')
|
||||
text(j(3), i(5), '2')
|
||||
text(j(3), i(6), '2')
|
||||
text(j(3), i(7), '2')
|
||||
text(j(3), i(8), '2')
|
||||
text(j(3), i(9), '2')
|
||||
text(j(3), i(10), '2')
|
||||
text(j(3), i(11), '2')
|
||||
text(j(3), i(12), '2')
|
||||
text(j(3), i(13), '2')
|
||||
text(j(3), i(14), '1')
|
||||
text(j(3), i(15), '1')
|
||||
text(j(3), i(16), '1')
|
||||
text(j(3), i(17), '1')
|
||||
text(j(3), i(18), '1')
|
||||
text(j(3), i(19), '1')
|
||||
text(j(3), i(20), '0')
|
||||
text(j(3), i(21), '0')
|
||||
text(j(3), i(22), '0')
|
||||
text(j(3), i(23), '0')
|
||||
text(j(3), i(24), '-1')
|
||||
text(j(3), i(25), '-1')
|
||||
text(j(3), i(26), '-1')
|
||||
text(j(3), i(27), '-1')
|
||||
text(j(3), i(28), '-1')
|
||||
text(j(3), i(29), '-1')
|
||||
text(j(3), i(30), '-2')
|
||||
text(j(3), i(31), '-2')
|
||||
text(j(3), i(32), '-2')
|
||||
text(j(3), i(33), '-2')
|
||||
text(j(3), i(34), '-2')
|
||||
text(j(3), i(35), '-2')
|
||||
text(j(3), i(36), '-2')
|
||||
text(j(3), i(37), '-2')
|
||||
text(j(3), i(38), '-2')
|
||||
text(j(3), i(39), '-2')
|
||||
text(j(3), i(40), '-2')
|
||||
text(j(3), i(41), '-2')
|
||||
text(j(3), i(42), '-2')
|
||||
|
||||
text(j(4), i(1), '2')
|
||||
text(j(4), i(2), '2')
|
||||
text(j(4), i(3), '2')
|
||||
text(j(4), i(4), '2')
|
||||
text(j(4), i(5), '2')
|
||||
text(j(4), i(6), '2')
|
||||
text(j(4), i(7), '2')
|
||||
text(j(4), i(8), '2')
|
||||
text(j(4), i(9), '2')
|
||||
text(j(4), i(10), '2')
|
||||
text(j(4), i(11), '2')
|
||||
text(j(4), i(12), '2')
|
||||
text(j(4), i(13), '2')
|
||||
text(j(4), i(14), '1')
|
||||
text(j(4), i(15), '1')
|
||||
text(j(4), i(16), '1')
|
||||
text(j(4), i(17), '1')
|
||||
text(j(4), i(18), '1')
|
||||
text(j(4), i(19), '1')
|
||||
text(j(4), i(20), '0')
|
||||
text(j(4), i(21), '0')
|
||||
text(j(4), i(22), '0')
|
||||
text(j(4), i(23), '0')
|
||||
text(j(4), i(24), '-1')
|
||||
text(j(4), i(25), '-1')
|
||||
text(j(4), i(26), '-1')
|
||||
text(j(4), i(27), '-1')
|
||||
text(j(4), i(28), '-1')
|
||||
text(j(4), i(29), '-1')
|
||||
text(j(4), i(30), '-2')
|
||||
text(j(4), i(31), '-2')
|
||||
text(j(4), i(32), '-2')
|
||||
text(j(4), i(33), '-2')
|
||||
text(j(4), i(34), '-2')
|
||||
text(j(4), i(35), '-2')
|
||||
text(j(4), i(36), '-2')
|
||||
text(j(4), i(37), '-2')
|
||||
text(j(4), i(38), '-2')
|
||||
text(j(4), i(39), '-2')
|
||||
text(j(4), i(40), '-2')
|
||||
text(j(4), i(41), '-2')
|
||||
text(j(4), i(42), '-2')
|
||||
|
||||
text(j(5), i(1), '2')
|
||||
text(j(5), i(2), '2')
|
||||
text(j(5), i(3), '2')
|
||||
text(j(5), i(4), '2')
|
||||
text(j(5), i(5), '2')
|
||||
text(j(5), i(6), '2')
|
||||
text(j(5), i(7), '2')
|
||||
text(j(5), i(8), '2')
|
||||
text(j(5), i(9), '2')
|
||||
text(j(5), i(10), '2')
|
||||
text(j(5), i(11), '2')
|
||||
text(j(5), i(12), '1')
|
||||
text(j(5), i(13), '1')
|
||||
text(j(5), i(14), '1')
|
||||
text(j(5), i(15), '1')
|
||||
text(j(5), i(16), '1')
|
||||
text(j(5), i(17), '1')
|
||||
text(j(5), i(18), '0')
|
||||
text(j(5), i(19), '0')
|
||||
text(j(5), i(20), '0')
|
||||
text(j(5), i(21), '0')
|
||||
text(j(5), i(22), '0')
|
||||
text(j(5), i(23), '0')
|
||||
text(j(5), i(24), '0')
|
||||
text(j(5), i(25), '0')
|
||||
text(j(5), i(26), '-1')
|
||||
text(j(5), i(27), '-1')
|
||||
text(j(5), i(28), '-1')
|
||||
text(j(5), i(29), '-1')
|
||||
text(j(5), i(30), '-1')
|
||||
text(j(5), i(31), '-1')
|
||||
text(j(5), i(32), '-2')
|
||||
text(j(5), i(33), '-2')
|
||||
text(j(5), i(34), '-2')
|
||||
text(j(5), i(35), '-2')
|
||||
text(j(5), i(36), '-2')
|
||||
text(j(5), i(37), '-2')
|
||||
text(j(5), i(38), '-2')
|
||||
text(j(5), i(39), '-2')
|
||||
text(j(5), i(40), '-2')
|
||||
text(j(5), i(41), '-2')
|
||||
text(j(5), i(42), '-2')
|
||||
|
||||
text(j(6), i(1), '2')
|
||||
text(j(6), i(2), '2')
|
||||
text(j(6), i(3), '2')
|
||||
text(j(6), i(4), '2')
|
||||
text(j(6), i(5), '2')
|
||||
text(j(6), i(6), '2')
|
||||
text(j(6), i(7), '2')
|
||||
text(j(6), i(8), '2')
|
||||
text(j(6), i(9), '2')
|
||||
text(j(6), i(10), '2')
|
||||
text(j(6), i(11), '2')
|
||||
text(j(6), i(12), '1')
|
||||
text(j(6), i(13), '1')
|
||||
text(j(6), i(14), '1')
|
||||
text(j(6), i(15), '1')
|
||||
text(j(6), i(16), '1')
|
||||
text(j(6), i(17), '1')
|
||||
text(j(6), i(18), '0')
|
||||
text(j(6), i(19), '0')
|
||||
text(j(6), i(20), '0')
|
||||
text(j(6), i(21), '0')
|
||||
text(j(6), i(22), '0')
|
||||
text(j(6), i(23), '0')
|
||||
text(j(6), i(24), '0')
|
||||
text(j(6), i(25), '0')
|
||||
text(j(6), i(26), '-1')
|
||||
text(j(6), i(27), '-1')
|
||||
text(j(6), i(28), '-1')
|
||||
text(j(6), i(29), '-1')
|
||||
text(j(6), i(30), '-1')
|
||||
text(j(6), i(31), '-1')
|
||||
text(j(6), i(32), '-2')
|
||||
text(j(6), i(33), '-2')
|
||||
text(j(6), i(34), '-2')
|
||||
text(j(6), i(35), '-2')
|
||||
text(j(6), i(36), '-2')
|
||||
text(j(6), i(37), '-2')
|
||||
text(j(6), i(38), '-2')
|
||||
text(j(6), i(39), '-2')
|
||||
text(j(6), i(40), '-2')
|
||||
text(j(6), i(41), '-2')
|
||||
text(j(6), i(42), '-2')
|
||||
|
||||
text(j(7), i(1), '2')
|
||||
text(j(7), i(2), '2')
|
||||
text(j(7), i(3), '2')
|
||||
text(j(7), i(4), '2')
|
||||
text(j(7), i(5), '2')
|
||||
text(j(7), i(6), '2')
|
||||
text(j(7), i(7), '2')
|
||||
text(j(7), i(8), '2')
|
||||
text(j(7), i(9), '2')
|
||||
text(j(7), i(10), '2')
|
||||
text(j(7), i(11), '2')
|
||||
text(j(7), i(12), '1')
|
||||
text(j(7), i(13), '1')
|
||||
text(j(7), i(14), '1')
|
||||
text(j(7), i(15), '1')
|
||||
text(j(7), i(16), '1')
|
||||
text(j(7), i(17), '1')
|
||||
text(j(7), i(18), '0')
|
||||
text(j(7), i(19), '0')
|
||||
text(j(7), i(20), '0')
|
||||
text(j(7), i(21), '0')
|
||||
text(j(7), i(22), '0')
|
||||
text(j(7), i(23), '0')
|
||||
text(j(7), i(24), '0')
|
||||
text(j(7), i(25), '0')
|
||||
text(j(7), i(26), '-1')
|
||||
text(j(7), i(27), '-1')
|
||||
text(j(7), i(28), '-1')
|
||||
text(j(7), i(29), '-1')
|
||||
text(j(7), i(30), '-1')
|
||||
text(j(7), i(31), '-1')
|
||||
text(j(7), i(32), '-2')
|
||||
text(j(7), i(33), '-2')
|
||||
text(j(7), i(34), '-2')
|
||||
text(j(7), i(35), '-2')
|
||||
text(j(7), i(36), '-2')
|
||||
text(j(7), i(37), '-2')
|
||||
text(j(7), i(38), '-2')
|
||||
text(j(7), i(39), '-2')
|
||||
text(j(7), i(40), '-2')
|
||||
text(j(7), i(41), '-2')
|
||||
text(j(7), i(42), '-2')
|
||||
|
||||
text(j(8), i(1), '2')
|
||||
text(j(8), i(2), '2')
|
||||
text(j(8), i(3), '2')
|
||||
text(j(8), i(4), '2')
|
||||
text(j(8), i(5), '2')
|
||||
text(j(8), i(6), '2')
|
||||
text(j(8), i(7), '2')
|
||||
text(j(8), i(8), '2')
|
||||
text(j(8), i(9), '2')
|
||||
text(j(8), i(10), '1')
|
||||
text(j(8), i(11), '1')
|
||||
text(j(8), i(12), '1')
|
||||
text(j(8), i(13), '1')
|
||||
text(j(8), i(14), '1')
|
||||
text(j(8), i(15), '1')
|
||||
text(j(8), i(16), '1')
|
||||
text(j(8), i(17), '1')
|
||||
text(j(8), i(18), '0')
|
||||
text(j(8), i(19), '0')
|
||||
text(j(8), i(20), '0')
|
||||
text(j(8), i(21), '0')
|
||||
text(j(8), i(22), '0')
|
||||
text(j(8), i(23), '0')
|
||||
text(j(8), i(24), '0')
|
||||
text(j(8), i(25), '0')
|
||||
text(j(8), i(26), '-1')
|
||||
text(j(8), i(27), '-1')
|
||||
text(j(8), i(28), '-1')
|
||||
text(j(8), i(29), '-1')
|
||||
text(j(8), i(30), '-2')
|
||||
text(j(8), i(31), '-2')
|
||||
text(j(8), i(32), '-2')
|
||||
text(j(8), i(33), '-2')
|
||||
text(j(8), i(34), '-2')
|
||||
text(j(8), i(35), '-2')
|
||||
text(j(8), i(36), '-2')
|
||||
text(j(8), i(37), '-2')
|
||||
text(j(8), i(38), '-2')
|
||||
text(j(8), i(39), '-2')
|
||||
text(j(8), i(40), '-2')
|
||||
text(j(8), i(41), '-2')
|
||||
text(j(8), i(42), '-2')
|
||||
|
||||
print -dpng pd_cpa.png
|
||||
|
||||
|
||||
|
||||
|
||||
|
333
pipelined/srt/stine/srt4_pd2.m
Normal file
333
pipelined/srt/stine/srt4_pd2.m
Normal file
@ -0,0 +1,333 @@
|
||||
%
|
||||
% Clear all variables and screen
|
||||
clear
|
||||
clf
|
||||
% Define the number of bits (input Dividend)
|
||||
n = 4;
|
||||
%
|
||||
% Define Divisor Range
|
||||
% Normalized Floating Point [Dmin,Dmax] = [1,2]
|
||||
% Normalized Fixed Point [Dmin, Dmax] =[1/2,1]
|
||||
%
|
||||
Dminimum = 1.0/2;
|
||||
Dmaximum = 2.0/2;
|
||||
% Define an ulp
|
||||
ulp = 2^(-n);
|
||||
% radix = beta
|
||||
beta = 4;
|
||||
% rho = redundancy factor -> SHOULD ALWAYS BE >= THAN 1/2
|
||||
%
|
||||
% SD representations have alpha < beta - 1
|
||||
%
|
||||
% alpha = ceil(beta/2) minimially redundant
|
||||
% alpha = beta -1 maximally redundant (rho = 1)
|
||||
% alpha = (beta-1)/2 nonredundant
|
||||
% alpha > beta - 1 over-redundant
|
||||
%
|
||||
rho = 2/3;
|
||||
% Calculation of max digit set
|
||||
alpha = rho*(beta-1);
|
||||
% Da contains digit set
|
||||
q = [];
|
||||
for i = -alpha:alpha
|
||||
q = [q; i];
|
||||
end
|
||||
% 4r(i-1)/D values
|
||||
hold on
|
||||
% figure(1)
|
||||
grid off
|
||||
for i = 1:length(q)
|
||||
x = -rho+q(i):ulp:rho+q(i);
|
||||
% Plot redundancy (overlap) Positive
|
||||
z = [rho+q(i),rho+q(i)];
|
||||
y = [x(length(x))-q(i),0];
|
||||
% Plot redundancy (overlap) Negative
|
||||
if (i ~= length(q))
|
||||
w = [-rho+q(i+1)-q(i+1),0];
|
||||
u = [-rho+q(i+1),-rho+q(i+1)];
|
||||
% plot(u,w,'b')
|
||||
end
|
||||
% plot(x,x-q(i))
|
||||
% plot(z,y,'r')
|
||||
|
||||
end
|
||||
% title('Robertson Diagram for Radix-4 SRT Divison')
|
||||
|
||||
Np = 3;
|
||||
Nd = 3;
|
||||
Dmin = Dminimum;
|
||||
Dmax = Dmaximum;
|
||||
ulpd = 2^(-Nd);
|
||||
ulpp = 2^(-Np);
|
||||
|
||||
%
|
||||
% Plot Atkins P-D plot
|
||||
% Normalized Floating Point [Dmin,Dmax] = [1,2]
|
||||
% Normalized Fixed Point [Dmin, Dmax] =[1/2,1]
|
||||
%
|
||||
Dmin = Dminimum;
|
||||
Dmax = Dmaximum;
|
||||
for i = 1:length(q)
|
||||
D = Dmin:ulpd:Dmax;
|
||||
P1 = (rho+q(i))*D;
|
||||
P2 = (-rho+q(i))*D;
|
||||
hold on
|
||||
p1 = plot(D,P1,'b');
|
||||
p2 = plot(D,P2,'r');
|
||||
axis([Dmin Dmax -beta*rho*Dmaximum beta*rho*Dmaximum])
|
||||
xticks(D)
|
||||
p1.LineWidth = 2.0;
|
||||
p2.LineWidth = 2.0;
|
||||
end
|
||||
|
||||
% Let's make x axis binary
|
||||
D = Dmin:ulpd:Dmax;
|
||||
j = [];
|
||||
for i=1:length(D)
|
||||
j = [j disp_bin(D(i), 1, 3)];
|
||||
end
|
||||
yk = [];
|
||||
yk2 = [];
|
||||
for i=-2.5:0.5:2.5;
|
||||
yk = [yk disp_bin(i, 3, 3)];
|
||||
yk2 = [yk2 i];
|
||||
end
|
||||
xtickangle(90)
|
||||
xticklabels(j)
|
||||
yticklabels(yk)
|
||||
|
||||
% Let's draw allow points on PD plot
|
||||
% Positive Portions
|
||||
index = 1;
|
||||
i = 0:ulpp:rho*beta*Dmaximum;
|
||||
for j = Dmin:ulpd:Dmax
|
||||
plot(j*ones(1,length(i)),i,'k');
|
||||
end
|
||||
|
||||
j = Dmin:ulpd:Dmax;
|
||||
for i = 0:ulpp:rho*beta*Dmaximum
|
||||
plot(j,i*ones(length(j)),'k');
|
||||
end
|
||||
|
||||
% Negative Portions
|
||||
index = 1;
|
||||
i = 0:-ulpp:rho*-beta*Dmaximum;
|
||||
for j = Dmin:ulpd:Dmax
|
||||
plot(j*ones(1,length(i)),i,'k');
|
||||
end
|
||||
|
||||
j = Dmin:ulpd:Dmax;
|
||||
for i = 0:-ulpp:-rho*beta*Dmaximum
|
||||
plot(j,i*ones(length(j)),'k');
|
||||
end
|
||||
|
||||
% Labels and Printing
|
||||
xlh = xlabel(['Divisor (d)']);
|
||||
xlh.Position(2) = xlh.Position(2) - 0.1;
|
||||
xlh.FontSize = 18;
|
||||
ylh = ylabel(['P = 4 \cdot w_i']);
|
||||
ylh.Position(1) = ylh.Position(1)-0.02;
|
||||
ylh.FontSize = 18;
|
||||
|
||||
% Containment Values (placed manually although not bad)
|
||||
m2 = [5/6 1.0 5/4 11/8 11/8];
|
||||
m1 = [1/4 1/4 1/2 1/2 1/2];
|
||||
m0 = [-1/4 -1/4 -1/2 -1/2 -1/2];
|
||||
m1b = [-5/6 -1 -5/4 -11/8 -11/8];
|
||||
x2 = Dmin:ulpd:Dmax;
|
||||
s2 = stairs(x2, m2);
|
||||
s2.Color = '#8f08d1';
|
||||
s2.LineWidth = 3.0;
|
||||
s1 = stairs(x2, m1);
|
||||
s1.Color = '#8f08d1';
|
||||
s1.LineWidth = 3.0;
|
||||
s0 = stairs(x2, m0);
|
||||
s0.Color = '#8f08d1';
|
||||
s0.LineWidth = 3.0;
|
||||
s1b = stairs(x2, m1b);
|
||||
s1b.Color = '#8f08d1';
|
||||
s1b.LineWidth = 3.0;
|
||||
|
||||
% Place manually Quotient (ugh)
|
||||
j = Dmin+ulpd/2:ulpd:Dmax;
|
||||
i = rho*beta*Dmaximum-ulpp*3/4:-ulpp:-rho*beta*Dmaximum;
|
||||
text(j(1), i(1), '2')
|
||||
text(j(1), i(2), '2')
|
||||
text(j(1), i(3), '2')
|
||||
text(j(1), i(4), '2')
|
||||
text(j(1), i(5), '2')
|
||||
text(j(1), i(6), '2')
|
||||
text(j(1), i(7), '2')
|
||||
text(j(1), i(8), '2')
|
||||
text(j(1), i(9), '2')
|
||||
text(j(1), i(10), '2')
|
||||
text(j(1), i(11), '2')
|
||||
text(j(1), i(12), '2')
|
||||
text(j(1), i(13), '2')
|
||||
text(j(1), i(14), '2')
|
||||
error1 = text(j(1), i(15), 'Full Precision', 'FontSize', 16);
|
||||
text(j(1), i(16), '1')
|
||||
text(j(1), i(17), '1')
|
||||
text(j(1), i(18), '1')
|
||||
text(j(1), i(19), '1')
|
||||
text(j(1), i(20), '0')
|
||||
text(j(1), i(21), '0')
|
||||
text(j(1), i(22), '0')
|
||||
text(j(1), i(23), '0')
|
||||
text(j(1), i(24), '-1')
|
||||
text(j(1), i(25), '-1')
|
||||
text(j(1), i(26), '-1')
|
||||
text(j(1), i(27), '-1')
|
||||
error2 = text(j(1), i(28), 'Full Precision', 'FontSize', 16);
|
||||
text(j(1), i(29), '-2')
|
||||
text(j(1), i(30), '-2')
|
||||
text(j(1), i(31), '-2')
|
||||
text(j(1), i(32), '-2')
|
||||
text(j(1), i(33), '-2')
|
||||
text(j(1), i(34), '-2')
|
||||
text(j(1), i(35), '-2')
|
||||
text(j(1), i(36), '-2')
|
||||
text(j(1), i(37), '-2')
|
||||
text(j(1), i(38), '-2')
|
||||
text(j(1), i(39), '-2')
|
||||
text(j(1), i(40), '-2')
|
||||
text(j(1), i(41), '-2')
|
||||
text(j(1), i(42), '-2')
|
||||
|
||||
text(j(2), i(1), '2')
|
||||
text(j(2), i(2), '2')
|
||||
text(j(2), i(3), '2')
|
||||
text(j(2), i(4), '2')
|
||||
text(j(2), i(5), '2')
|
||||
text(j(2), i(6), '2')
|
||||
text(j(2), i(7), '2')
|
||||
text(j(2), i(8), '2')
|
||||
text(j(2), i(9), '2')
|
||||
text(j(2), i(10), '2')
|
||||
text(j(2), i(11), '2')
|
||||
text(j(2), i(12), '2')
|
||||
text(j(2), i(13), '2')
|
||||
text(j(2), i(14), '1')
|
||||
text(j(2), i(15), '1')
|
||||
text(j(2), i(16), '1')
|
||||
text(j(2), i(17), '1')
|
||||
text(j(2), i(18), '1')
|
||||
text(j(2), i(19), '1')
|
||||
text(j(2), i(20), '0')
|
||||
text(j(2), i(21), '0')
|
||||
text(j(2), i(22), '0')
|
||||
text(j(2), i(23), '0')
|
||||
text(j(2), i(24), '-1')
|
||||
text(j(2), i(25), '-1')
|
||||
text(j(2), i(26), '-1')
|
||||
text(j(2), i(27), '-1')
|
||||
text(j(2), i(28), '-1')
|
||||
text(j(2), i(29), '-1')
|
||||
text(j(2), i(30), '-2')
|
||||
text(j(2), i(31), '-2')
|
||||
text(j(2), i(32), '-2')
|
||||
text(j(2), i(33), '-2')
|
||||
text(j(2), i(34), '-2')
|
||||
text(j(2), i(35), '-2')
|
||||
text(j(2), i(36), '-2')
|
||||
text(j(2), i(37), '-2')
|
||||
text(j(2), i(38), '-2')
|
||||
text(j(2), i(39), '-2')
|
||||
text(j(2), i(40), '-2')
|
||||
text(j(2), i(41), '-2')
|
||||
text(j(2), i(42), '-2')
|
||||
|
||||
text(j(3), i(1), '2')
|
||||
text(j(3), i(2), '2')
|
||||
text(j(3), i(3), '2')
|
||||
text(j(3), i(4), '2')
|
||||
text(j(3), i(5), '2')
|
||||
text(j(3), i(6), '2')
|
||||
text(j(3), i(7), '2')
|
||||
text(j(3), i(8), '2')
|
||||
text(j(3), i(9), '2')
|
||||
text(j(3), i(10), '2')
|
||||
text(j(3), i(11), '2')
|
||||
text(j(3), i(12), '1')
|
||||
text(j(3), i(13), '1')
|
||||
text(j(3), i(14), '1')
|
||||
text(j(3), i(15), '1')
|
||||
text(j(3), i(16), '1')
|
||||
text(j(3), i(17), '1')
|
||||
text(j(3), i(18), '0')
|
||||
text(j(3), i(19), '0')
|
||||
text(j(3), i(20), '0')
|
||||
text(j(3), i(21), '0')
|
||||
text(j(3), i(22), '0')
|
||||
text(j(3), i(23), '0')
|
||||
text(j(3), i(24), '0')
|
||||
text(j(3), i(25), '0')
|
||||
text(j(3), i(26), '-1')
|
||||
text(j(3), i(27), '-1')
|
||||
text(j(3), i(28), '-1')
|
||||
text(j(3), i(29), '-1')
|
||||
text(j(3), i(30), '-1')
|
||||
text(j(3), i(31), '-1')
|
||||
text(j(3), i(32), '-2')
|
||||
text(j(3), i(33), '-2')
|
||||
text(j(3), i(34), '-2')
|
||||
text(j(3), i(35), '-2')
|
||||
text(j(3), i(36), '-2')
|
||||
text(j(3), i(37), '-2')
|
||||
text(j(3), i(38), '-2')
|
||||
text(j(3), i(39), '-2')
|
||||
text(j(3), i(40), '-2')
|
||||
text(j(3), i(41), '-2')
|
||||
text(j(3), i(42), '-2')
|
||||
|
||||
text(j(4), i(1), '2')
|
||||
text(j(4), i(2), '2')
|
||||
text(j(4), i(3), '2')
|
||||
text(j(4), i(4), '2')
|
||||
text(j(4), i(5), '2')
|
||||
text(j(4), i(6), '2')
|
||||
text(j(4), i(7), '2')
|
||||
text(j(4), i(8), '2')
|
||||
text(j(4), i(9), '2')
|
||||
text(j(4), i(10), '2')
|
||||
text(j(4), i(11), '1')
|
||||
text(j(4), i(12), '1')
|
||||
text(j(4), i(13), '1')
|
||||
text(j(4), i(14), '1')
|
||||
text(j(4), i(15), '1')
|
||||
text(j(4), i(16), '1')
|
||||
text(j(4), i(17), '1')
|
||||
text(j(4), i(18), '0')
|
||||
text(j(4), i(19), '0')
|
||||
text(j(4), i(20), '0')
|
||||
text(j(4), i(21), '0')
|
||||
text(j(4), i(22), '0')
|
||||
text(j(4), i(23), '0')
|
||||
text(j(4), i(24), '0')
|
||||
text(j(4), i(25), '0')
|
||||
text(j(4), i(26), '-1')
|
||||
text(j(4), i(27), '-1')
|
||||
text(j(4), i(28), '-1')
|
||||
text(j(4), i(29), '-1')
|
||||
text(j(4), i(30), '-1')
|
||||
text(j(4), i(31), '-1')
|
||||
text(j(4), i(32), '-1')
|
||||
text(j(4), i(33), '-2')
|
||||
text(j(4), i(34), '-2')
|
||||
text(j(4), i(35), '-2')
|
||||
text(j(4), i(36), '-2')
|
||||
text(j(4), i(37), '-2')
|
||||
text(j(4), i(38), '-2')
|
||||
text(j(4), i(39), '-2')
|
||||
text(j(4), i(40), '-2')
|
||||
text(j(4), i(41), '-2')
|
||||
text(j(4), i(42), '-2')
|
||||
|
||||
|
||||
|
||||
print -dpng pd_bad.png
|
||||
|
||||
|
||||
|
||||
|
||||
|
855
pipelined/srt/stine/srt4_pd3.m
Normal file
855
pipelined/srt/stine/srt4_pd3.m
Normal file
@ -0,0 +1,855 @@
|
||||
%
|
||||
% Clear all variables and screen
|
||||
clear
|
||||
clf
|
||||
% Define the number of bits (input Dividend)
|
||||
n = 4;
|
||||
%
|
||||
% Define Divisor Range
|
||||
% Normalized Floating Point [Dmin,Dmax] = [1,2]
|
||||
% Normalized Fixed Point [Dmin, Dmax] =[1/2,1]
|
||||
%
|
||||
Dminimum = 1.0/2;
|
||||
Dmaximum = 2.0/2;
|
||||
% Define an ulp
|
||||
ulp = 2^(-n);
|
||||
% radix = beta
|
||||
beta = 4;
|
||||
% rho = redundancy factor -> SHOULD ALWAYS BE >= THAN 1/2
|
||||
%
|
||||
% SD representations have alpha < beta - 1
|
||||
%
|
||||
% alpha = ceil(beta/2) minimially redundant
|
||||
% alpha = beta -1 maximally redundant (rho = 1)
|
||||
% alpha = (beta-1)/2 nonredundant
|
||||
% alpha > beta - 1 over-redundant
|
||||
%
|
||||
rho = 2/3;
|
||||
% Calculation of max digit set
|
||||
alpha = rho*(beta-1);
|
||||
% Da contains digit set
|
||||
q = [];
|
||||
for i = -alpha:alpha
|
||||
q = [q; i];
|
||||
end
|
||||
% 4r(i-1)/D values
|
||||
hold on
|
||||
% figure(1)
|
||||
grid off
|
||||
for i = 1:length(q)
|
||||
x = -rho+q(i):ulp:rho+q(i);
|
||||
% Plot redundancy (overlap) Positive
|
||||
z = [rho+q(i),rho+q(i)];
|
||||
y = [x(length(x))-q(i),0];
|
||||
% Plot redundancy (overlap) Negative
|
||||
if (i ~= length(q))
|
||||
w = [-rho+q(i+1)-q(i+1),0];
|
||||
u = [-rho+q(i+1),-rho+q(i+1)];
|
||||
% plot(u,w,'b')
|
||||
end
|
||||
% plot(x,x-q(i))
|
||||
% plot(z,y,'r')
|
||||
|
||||
end
|
||||
% title('Robertson Diagram for Radix-4 SRT Divison')
|
||||
|
||||
%
|
||||
% Plot Atkins P-D plot
|
||||
% Normalized Floating Point [Dmin,Dmax] = [1,2]
|
||||
% Normalized Fixed Point [Dmin, Dmax] =[1/2,1]
|
||||
%
|
||||
Dmin = Dminimum;
|
||||
Dmax = Dmaximum;
|
||||
for i = 1:length(q)
|
||||
D = Dmin:ulp:Dmax;
|
||||
P1 = (rho+q(i))*D;
|
||||
P2 = (-rho+q(i))*D;
|
||||
hold on
|
||||
p1 = plot(D,P1,'b');
|
||||
p2 = plot(D,P2,'r');
|
||||
axis([Dmin Dmax -beta*rho*Dmaximum beta*rho*Dmaximum])
|
||||
xticks(D)
|
||||
p1.LineWidth = 2.0;
|
||||
p2.LineWidth = 2.0;
|
||||
end
|
||||
|
||||
% Let's make x axis binary
|
||||
j = [];
|
||||
for i=1:length(D)
|
||||
j = [j disp_bin(D(i), 1, 4)];
|
||||
end
|
||||
yk = [];
|
||||
yk2 = [];
|
||||
for i=-2.5:0.5:2.5;
|
||||
yk = [yk disp_bin(i, 3, 4)];
|
||||
yk2 = [yk2 i];
|
||||
end
|
||||
xtickangle(90)
|
||||
xticklabels(j)
|
||||
yticklabels(yk)
|
||||
|
||||
Np = 4;
|
||||
Nd = 4;
|
||||
Dmin = Dminimum;
|
||||
Dmax = Dmaximum;
|
||||
ulpd = 2^(-Nd);
|
||||
ulpp = 2^(-Np);
|
||||
|
||||
% Let's draw allow points on PD plot
|
||||
% Positive Portions
|
||||
index = 1;
|
||||
i = 0:ulpp:rho*beta*Dmaximum;
|
||||
for j = Dmin:ulpd:Dmax
|
||||
plot(j*ones(1,length(i)),i,'k');
|
||||
end
|
||||
|
||||
j = Dmin:ulpd:Dmax;
|
||||
for i = 0:ulpp:rho*beta*Dmaximum
|
||||
plot(j,i*ones(length(j)),'k');
|
||||
end
|
||||
|
||||
% Negative Portions
|
||||
index = 1;
|
||||
i = 0:-ulpp:rho*-beta*Dmaximum;
|
||||
for j = Dmin:ulpd:Dmax
|
||||
plot(j*ones(1,length(i)),i,'k');
|
||||
end
|
||||
|
||||
j = Dmin:ulpd:Dmax;
|
||||
for i = 0:-ulpp:-rho*beta*Dmaximum
|
||||
plot(j,i*ones(length(j)),'k');
|
||||
end
|
||||
|
||||
% Labels and Printing
|
||||
xlh = xlabel(['Divisor (d)']);
|
||||
xlh.Position(2) = xlh.Position(2) - 0.1;
|
||||
%xlh.FontSize = 18;
|
||||
ylh = ylabel(['P = 4 \cdot w_i']);
|
||||
ylh.Position(1) = ylh.Position(1)-0.02;
|
||||
%ylh.FontSize = 18;
|
||||
|
||||
% Containment Values (placed manually although not bad)
|
||||
m2 = [3/4 7/8 15/16 1.0 9/8 19/16 5/4 6/4 6/4];
|
||||
m1 = [1/4 1/4 1/4 1/4 3/8 3/8 1/2 1/2 1/2];
|
||||
m0 = [-1/4 -3/8 -3/8 -3/8 -1/2 -1/2 -1/2 -1/2 -1/2];
|
||||
m1b = [-13/16 -15/16 -1 -9/8 -5/4 -5/4 -11/8 -6/4 -6/4];
|
||||
x2 = Dmin:ulpd:Dmax;
|
||||
s2 = stairs(x2, m2);
|
||||
s2.Color = '#8f08d1';
|
||||
s2.LineWidth = 3.0;
|
||||
s1 = stairs(x2, m1);
|
||||
s1.Color = '#8f08d1';
|
||||
s1.LineWidth = 3.0;
|
||||
s0 = stairs(x2, m0);
|
||||
s0.Color = '#8f08d1';
|
||||
s0.LineWidth = 3.0;
|
||||
s1b = stairs(x2, m1b);
|
||||
s1b.Color = '#8f08d1';
|
||||
s1b.LineWidth = 3.0;
|
||||
|
||||
% Place manually Quotient (ugh)
|
||||
j = Dmin+ulpd/2:ulpd:Dmax;
|
||||
i = rho*beta*Dmaximum-ulpp:-ulpp:-rho*beta*Dmaximum;
|
||||
|
||||
% 1
|
||||
text(j(1), i(1), '2')
|
||||
text(j(1), i(2), '2')
|
||||
text(j(1), i(3), '2')
|
||||
text(j(1), i(4), '2')
|
||||
text(j(1), i(5), '2')
|
||||
text(j(1), i(6), '2')
|
||||
text(j(1), i(7), '2')
|
||||
text(j(1), i(8), '2')
|
||||
text(j(1), i(9), '2')
|
||||
text(j(1), i(10), '2')
|
||||
text(j(1), i(11), '2')
|
||||
text(j(1), i(12), '2')
|
||||
text(j(1), i(13), '2')
|
||||
text(j(1), i(14), '2')
|
||||
text(j(1), i(15), '2')
|
||||
text(j(1), i(16), '2')
|
||||
text(j(1), i(17), '2')
|
||||
text(j(1), i(18), '2')
|
||||
text(j(1), i(19), '2')
|
||||
text(j(1), i(20), '2')
|
||||
text(j(1), i(21), '2')
|
||||
text(j(1), i(22), '2')
|
||||
text(j(1), i(23), '2')
|
||||
text(j(1), i(24), '2')
|
||||
text(j(1), i(25), '2')
|
||||
text(j(1), i(26), '2')
|
||||
text(j(1), i(27), '2')
|
||||
text(j(1), i(28), '2')
|
||||
text(j(1), i(29), '2')
|
||||
text(j(1), i(30), '2')
|
||||
text(j(1), i(31), '1')
|
||||
text(j(1), i(32), '1')
|
||||
text(j(1), i(33), '1')
|
||||
text(j(1), i(34), '1')
|
||||
text(j(1), i(35), '1')
|
||||
text(j(1), i(36), '1')
|
||||
text(j(1), i(37), '1')
|
||||
text(j(1), i(38), '1')
|
||||
text(j(1), i(39), '0')
|
||||
text(j(1), i(40), '0')
|
||||
text(j(1), i(41), '0')
|
||||
text(j(1), i(42), '0')
|
||||
|
||||
text(j(1), i(43), '0')
|
||||
text(j(1), i(44), '0')
|
||||
text(j(1), i(45), '0')
|
||||
text(j(1), i(46), '0')
|
||||
text(j(1), i(47), '-1')
|
||||
text(j(1), i(48), '-1')
|
||||
text(j(1), i(49), '-1')
|
||||
text(j(1), i(50), '-1')
|
||||
text(j(1), i(51), '-1')
|
||||
text(j(1), i(52), '-1')
|
||||
text(j(1), i(53), '-1')
|
||||
text(j(1), i(54), '-1')
|
||||
text(j(1), i(55), '-1')
|
||||
text(j(1), i(56), '-2')
|
||||
text(j(1), i(57), '-2')
|
||||
text(j(1), i(58), '-2')
|
||||
text(j(1), i(59), '-2')
|
||||
text(j(1), i(60), '-2')
|
||||
text(j(1), i(61), '-2')
|
||||
text(j(1), i(62), '-2')
|
||||
text(j(1), i(63), '-2')
|
||||
text(j(1), i(64), '-2')
|
||||
text(j(1), i(65), '-2')
|
||||
text(j(1), i(66), '-2')
|
||||
text(j(1), i(67), '-2')
|
||||
text(j(1), i(68), '-2')
|
||||
text(j(1), i(69), '-2')
|
||||
text(j(1), i(70), '-2')
|
||||
text(j(1), i(71), '-2')
|
||||
text(j(1), i(72), '-2')
|
||||
text(j(1), i(73), '-2')
|
||||
text(j(1), i(74), '-2')
|
||||
text(j(1), i(75), '-2')
|
||||
text(j(1), i(76), '-2')
|
||||
text(j(1), i(77), '-2')
|
||||
text(j(1), i(78), '-2')
|
||||
text(j(1), i(79), '-2')
|
||||
text(j(1), i(80), '-2')
|
||||
text(j(1), i(81), '-2')
|
||||
text(j(1), i(82), '-2')
|
||||
text(j(1), i(83), '-2')
|
||||
text(j(1), i(84), '-2')
|
||||
|
||||
text(j(2), i(1), '2')
|
||||
text(j(2), i(2), '2')
|
||||
text(j(2), i(3), '2')
|
||||
text(j(2), i(4), '2')
|
||||
text(j(2), i(5), '2')
|
||||
text(j(2), i(6), '2')
|
||||
text(j(2), i(7), '2')
|
||||
text(j(2), i(8), '2')
|
||||
text(j(2), i(9), '2')
|
||||
text(j(2), i(10), '2')
|
||||
text(j(2), i(11), '2')
|
||||
text(j(2), i(12), '2')
|
||||
text(j(2), i(13), '2')
|
||||
text(j(2), i(14), '2')
|
||||
text(j(2), i(15), '2')
|
||||
text(j(2), i(16), '2')
|
||||
text(j(2), i(17), '2')
|
||||
text(j(2), i(18), '2')
|
||||
text(j(2), i(19), '2')
|
||||
text(j(2), i(20), '2')
|
||||
text(j(2), i(21), '2')
|
||||
text(j(2), i(22), '2')
|
||||
text(j(2), i(23), '2')
|
||||
text(j(2), i(24), '2')
|
||||
text(j(2), i(25), '2')
|
||||
text(j(2), i(26), '2')
|
||||
text(j(2), i(27), '2')
|
||||
text(j(2), i(28), '2')
|
||||
text(j(2), i(29), '1')
|
||||
text(j(2), i(30), '1')
|
||||
text(j(2), i(31), '1')
|
||||
text(j(2), i(32), '1')
|
||||
text(j(2), i(33), '1')
|
||||
text(j(2), i(34), '1')
|
||||
text(j(2), i(35), '1')
|
||||
text(j(2), i(36), '1')
|
||||
text(j(2), i(37), '1')
|
||||
text(j(2), i(38), '1')
|
||||
text(j(2), i(39), '0')
|
||||
text(j(2), i(40), '0')
|
||||
text(j(2), i(41), '0')
|
||||
text(j(2), i(42), '0')
|
||||
|
||||
text(j(2), i(43), '0')
|
||||
text(j(2), i(44), '0')
|
||||
text(j(2), i(45), '0')
|
||||
text(j(2), i(46), '0')
|
||||
text(j(2), i(47), '0')
|
||||
text(j(2), i(48), '0')
|
||||
text(j(2), i(49), '-1')
|
||||
text(j(2), i(50), '-1')
|
||||
text(j(2), i(51), '-1')
|
||||
text(j(2), i(52), '-1')
|
||||
text(j(2), i(53), '-1')
|
||||
text(j(2), i(54), '-1')
|
||||
text(j(2), i(55), '-1')
|
||||
text(j(2), i(56), '-1')
|
||||
text(j(2), i(57), '-1')
|
||||
text(j(2), i(58), '-2')
|
||||
text(j(2), i(59), '-2')
|
||||
text(j(2), i(60), '-2')
|
||||
text(j(2), i(61), '-2')
|
||||
text(j(2), i(62), '-2')
|
||||
text(j(2), i(63), '-2')
|
||||
text(j(2), i(64), '-2')
|
||||
text(j(2), i(65), '-2')
|
||||
text(j(2), i(66), '-2')
|
||||
text(j(2), i(67), '-2')
|
||||
text(j(2), i(68), '-2')
|
||||
text(j(2), i(69), '-2')
|
||||
text(j(2), i(70), '-2')
|
||||
text(j(2), i(71), '-2')
|
||||
text(j(2), i(72), '-2')
|
||||
text(j(2), i(73), '-2')
|
||||
text(j(2), i(74), '-2')
|
||||
text(j(2), i(75), '-2')
|
||||
text(j(2), i(76), '-2')
|
||||
text(j(2), i(77), '-2')
|
||||
text(j(2), i(78), '-2')
|
||||
text(j(2), i(79), '-2')
|
||||
text(j(2), i(80), '-2')
|
||||
text(j(2), i(81), '-2')
|
||||
text(j(2), i(82), '-2')
|
||||
text(j(2), i(83), '-2')
|
||||
text(j(2), i(84), '-2')
|
||||
|
||||
% 3
|
||||
text(j(3), i(1), '2')
|
||||
text(j(3), i(2), '2')
|
||||
text(j(3), i(3), '2')
|
||||
text(j(3), i(4), '2')
|
||||
text(j(3), i(5), '2')
|
||||
text(j(3), i(6), '2')
|
||||
text(j(3), i(7), '2')
|
||||
text(j(3), i(8), '2')
|
||||
text(j(3), i(9), '2')
|
||||
text(j(3), i(10), '2')
|
||||
text(j(3), i(11), '2')
|
||||
text(j(3), i(12), '2')
|
||||
text(j(3), i(13), '2')
|
||||
text(j(3), i(14), '2')
|
||||
text(j(3), i(15), '2')
|
||||
text(j(3), i(16), '2')
|
||||
text(j(3), i(17), '2')
|
||||
text(j(3), i(18), '2')
|
||||
text(j(3), i(19), '2')
|
||||
text(j(3), i(20), '2')
|
||||
text(j(3), i(21), '2')
|
||||
text(j(3), i(22), '2')
|
||||
text(j(3), i(23), '2')
|
||||
text(j(3), i(24), '2')
|
||||
text(j(3), i(25), '2')
|
||||
text(j(3), i(26), '2')
|
||||
text(j(3), i(27), '2')
|
||||
text(j(3), i(28), '1')
|
||||
text(j(3), i(29), '1')
|
||||
text(j(3), i(30), '1')
|
||||
text(j(3), i(31), '1')
|
||||
text(j(3), i(32), '1')
|
||||
text(j(3), i(33), '1')
|
||||
text(j(3), i(34), '1')
|
||||
text(j(3), i(35), '1')
|
||||
text(j(3), i(36), '1')
|
||||
text(j(3), i(37), '1')
|
||||
text(j(3), i(38), '1')
|
||||
text(j(3), i(39), '0')
|
||||
text(j(3), i(40), '0')
|
||||
text(j(3), i(41), '0')
|
||||
text(j(3), i(42), '0')
|
||||
|
||||
text(j(3), i(43), '0')
|
||||
text(j(3), i(44), '0')
|
||||
text(j(3), i(45), '0')
|
||||
text(j(3), i(46), '0')
|
||||
text(j(3), i(47), '0')
|
||||
text(j(3), i(48), '0')
|
||||
text(j(3), i(49), '-1')
|
||||
text(j(3), i(50), '-1')
|
||||
text(j(3), i(51), '-1')
|
||||
text(j(3), i(52), '-1')
|
||||
text(j(3), i(53), '-1')
|
||||
text(j(3), i(54), '-1')
|
||||
text(j(3), i(55), '-1')
|
||||
text(j(3), i(56), '-1')
|
||||
text(j(3), i(57), '-1')
|
||||
text(j(3), i(58), '-1')
|
||||
text(j(3), i(59), '-2')
|
||||
text(j(3), i(60), '-2')
|
||||
text(j(3), i(61), '-2')
|
||||
text(j(3), i(62), '-2')
|
||||
text(j(3), i(63), '-2')
|
||||
text(j(3), i(64), '-2')
|
||||
text(j(3), i(65), '-2')
|
||||
text(j(3), i(66), '-2')
|
||||
text(j(3), i(67), '-2')
|
||||
text(j(3), i(68), '-2')
|
||||
text(j(3), i(69), '-2')
|
||||
text(j(3), i(70), '-2')
|
||||
text(j(3), i(71), '-2')
|
||||
text(j(3), i(72), '-2')
|
||||
text(j(3), i(73), '-2')
|
||||
text(j(3), i(74), '-2')
|
||||
text(j(3), i(75), '-2')
|
||||
text(j(3), i(76), '-2')
|
||||
text(j(3), i(77), '-2')
|
||||
text(j(3), i(78), '-2')
|
||||
text(j(3), i(79), '-2')
|
||||
text(j(3), i(80), '-2')
|
||||
text(j(3), i(81), '-2')
|
||||
text(j(3), i(82), '-2')
|
||||
text(j(3), i(83), '-2')
|
||||
text(j(3), i(84), '-2')
|
||||
|
||||
% 4
|
||||
text(j(4), i(1), '2')
|
||||
text(j(4), i(2), '2')
|
||||
text(j(4), i(3), '2')
|
||||
text(j(4), i(4), '2')
|
||||
text(j(4), i(5), '2')
|
||||
text(j(4), i(6), '2')
|
||||
text(j(4), i(7), '2')
|
||||
text(j(4), i(8), '2')
|
||||
text(j(4), i(9), '2')
|
||||
text(j(4), i(10), '2')
|
||||
text(j(4), i(11), '2')
|
||||
text(j(4), i(12), '2')
|
||||
text(j(4), i(13), '2')
|
||||
text(j(4), i(14), '2')
|
||||
text(j(4), i(15), '2')
|
||||
text(j(4), i(16), '2')
|
||||
text(j(4), i(17), '2')
|
||||
text(j(4), i(18), '2')
|
||||
text(j(4), i(19), '2')
|
||||
text(j(4), i(20), '2')
|
||||
text(j(4), i(21), '2')
|
||||
text(j(4), i(22), '2')
|
||||
text(j(4), i(23), '2')
|
||||
text(j(4), i(24), '2')
|
||||
text(j(4), i(25), '2')
|
||||
text(j(4), i(26), '2')
|
||||
text(j(4), i(27), '1')
|
||||
text(j(4), i(28), '1')
|
||||
text(j(4), i(29), '1')
|
||||
text(j(4), i(30), '1')
|
||||
text(j(4), i(31), '1')
|
||||
text(j(4), i(32), '1')
|
||||
text(j(4), i(33), '1')
|
||||
text(j(4), i(34), '1')
|
||||
text(j(4), i(35), '1')
|
||||
text(j(4), i(36), '1')
|
||||
text(j(4), i(37), '1')
|
||||
text(j(4), i(38), '1')
|
||||
text(j(4), i(39), '0')
|
||||
text(j(4), i(40), '0')
|
||||
text(j(4), i(41), '0')
|
||||
text(j(4), i(42), '0')
|
||||
|
||||
text(j(4), i(43), '0')
|
||||
text(j(4), i(44), '0')
|
||||
text(j(4), i(45), '0')
|
||||
text(j(4), i(46), '0')
|
||||
text(j(4), i(47), '0')
|
||||
text(j(4), i(48), '0')
|
||||
text(j(4), i(49), '-1')
|
||||
text(j(4), i(50), '-1')
|
||||
text(j(4), i(51), '-1')
|
||||
text(j(4), i(52), '-1')
|
||||
text(j(4), i(53), '-1')
|
||||
text(j(4), i(54), '-1')
|
||||
text(j(4), i(55), '-1')
|
||||
text(j(4), i(56), '-1')
|
||||
text(j(4), i(57), '-1')
|
||||
text(j(4), i(58), '-1')
|
||||
text(j(4), i(59), '-1')
|
||||
text(j(4), i(60), '-1')
|
||||
text(j(4), i(61), '-2')
|
||||
text(j(4), i(62), '-2')
|
||||
text(j(4), i(63), '-2')
|
||||
text(j(4), i(64), '-2')
|
||||
text(j(4), i(65), '-2')
|
||||
text(j(4), i(66), '-2')
|
||||
text(j(4), i(67), '-2')
|
||||
text(j(4), i(68), '-2')
|
||||
text(j(4), i(69), '-2')
|
||||
text(j(4), i(70), '-2')
|
||||
text(j(4), i(71), '-2')
|
||||
text(j(4), i(72), '-2')
|
||||
text(j(4), i(73), '-2')
|
||||
text(j(4), i(74), '-2')
|
||||
text(j(4), i(75), '-2')
|
||||
text(j(4), i(76), '-2')
|
||||
text(j(4), i(77), '-2')
|
||||
text(j(4), i(78), '-2')
|
||||
text(j(4), i(79), '-2')
|
||||
text(j(4), i(80), '-2')
|
||||
text(j(4), i(81), '-2')
|
||||
text(j(4), i(82), '-2')
|
||||
text(j(4), i(83), '-2')
|
||||
text(j(4), i(84), '-2')
|
||||
|
||||
% 5
|
||||
text(j(5), i(1), '2')
|
||||
text(j(5), i(2), '2')
|
||||
text(j(5), i(3), '2')
|
||||
text(j(5), i(4), '2')
|
||||
text(j(5), i(5), '2')
|
||||
text(j(5), i(6), '2')
|
||||
text(j(5), i(7), '2')
|
||||
text(j(5), i(8), '2')
|
||||
text(j(5), i(9), '2')
|
||||
text(j(5), i(10), '2')
|
||||
text(j(5), i(11), '2')
|
||||
text(j(5), i(12), '2')
|
||||
text(j(5), i(13), '2')
|
||||
text(j(5), i(14), '2')
|
||||
text(j(5), i(15), '2')
|
||||
text(j(5), i(16), '2')
|
||||
text(j(5), i(17), '2')
|
||||
text(j(5), i(18), '2')
|
||||
text(j(5), i(19), '2')
|
||||
text(j(5), i(20), '2')
|
||||
text(j(5), i(21), '2')
|
||||
text(j(5), i(22), '2')
|
||||
text(j(5), i(23), '2')
|
||||
text(j(5), i(24), '2')
|
||||
text(j(5), i(25), '1')
|
||||
text(j(5), i(26), '1')
|
||||
text(j(5), i(27), '1')
|
||||
text(j(5), i(28), '1')
|
||||
text(j(5), i(29), '1')
|
||||
text(j(5), i(30), '1')
|
||||
text(j(5), i(31), '1')
|
||||
text(j(5), i(32), '1')
|
||||
text(j(5), i(33), '1')
|
||||
text(j(5), i(34), '1')
|
||||
text(j(5), i(35), '1')
|
||||
text(j(5), i(36), '1')
|
||||
text(j(5), i(37), '0')
|
||||
text(j(5), i(38), '0')
|
||||
text(j(5), i(39), '0')
|
||||
text(j(5), i(40), '0')
|
||||
text(j(5), i(41), '0')
|
||||
text(j(5), i(42), '0')
|
||||
|
||||
text(j(5), i(43), '0')
|
||||
text(j(5), i(44), '0')
|
||||
text(j(5), i(45), '0')
|
||||
text(j(5), i(46), '0')
|
||||
text(j(5), i(47), '0')
|
||||
text(j(5), i(48), '0')
|
||||
text(j(5), i(49), '0')
|
||||
text(j(5), i(50), '0')
|
||||
text(j(5), i(51), '-1')
|
||||
text(j(5), i(52), '-1')
|
||||
text(j(5), i(53), '-1')
|
||||
text(j(5), i(54), '-1')
|
||||
text(j(5), i(55), '-1')
|
||||
text(j(5), i(56), '-1')
|
||||
text(j(5), i(57), '-1')
|
||||
text(j(5), i(58), '-1')
|
||||
text(j(5), i(59), '-1')
|
||||
text(j(5), i(60), '-1')
|
||||
text(j(5), i(61), '-1')
|
||||
text(j(5), i(62), '-1')
|
||||
text(j(5), i(63), '-2')
|
||||
text(j(5), i(64), '-2')
|
||||
text(j(5), i(65), '-2')
|
||||
text(j(5), i(66), '-2')
|
||||
text(j(5), i(67), '-2')
|
||||
text(j(5), i(68), '-2')
|
||||
text(j(5), i(69), '-2')
|
||||
text(j(5), i(70), '-2')
|
||||
text(j(5), i(71), '-2')
|
||||
text(j(5), i(72), '-2')
|
||||
text(j(5), i(73), '-2')
|
||||
text(j(5), i(74), '-2')
|
||||
text(j(5), i(75), '-2')
|
||||
text(j(5), i(76), '-2')
|
||||
text(j(5), i(77), '-2')
|
||||
text(j(5), i(78), '-2')
|
||||
text(j(5), i(79), '-2')
|
||||
text(j(5), i(80), '-2')
|
||||
text(j(5), i(81), '-2')
|
||||
text(j(5), i(82), '-2')
|
||||
text(j(5), i(83), '-2')
|
||||
text(j(5), i(84), '-2')
|
||||
|
||||
% 6
|
||||
text(j(6), i(1), '2')
|
||||
text(j(6), i(2), '2')
|
||||
text(j(6), i(3), '2')
|
||||
text(j(6), i(4), '2')
|
||||
text(j(6), i(5), '2')
|
||||
text(j(6), i(6), '2')
|
||||
text(j(6), i(7), '2')
|
||||
text(j(6), i(8), '2')
|
||||
text(j(6), i(9), '2')
|
||||
text(j(6), i(10), '2')
|
||||
text(j(6), i(11), '2')
|
||||
text(j(6), i(12), '2')
|
||||
text(j(6), i(13), '2')
|
||||
text(j(6), i(14), '2')
|
||||
text(j(6), i(15), '2')
|
||||
text(j(6), i(16), '2')
|
||||
text(j(6), i(17), '2')
|
||||
text(j(6), i(18), '2')
|
||||
text(j(6), i(19), '2')
|
||||
text(j(6), i(20), '2')
|
||||
text(j(6), i(21), '2')
|
||||
text(j(6), i(22), '2')
|
||||
text(j(6), i(23), '2')
|
||||
text(j(6), i(24), '1')
|
||||
text(j(6), i(25), '1')
|
||||
text(j(6), i(26), '1')
|
||||
text(j(6), i(27), '1')
|
||||
text(j(6), i(28), '1')
|
||||
text(j(6), i(29), '1')
|
||||
text(j(6), i(30), '1')
|
||||
text(j(6), i(31), '1')
|
||||
text(j(6), i(32), '1')
|
||||
text(j(6), i(33), '1')
|
||||
text(j(6), i(34), '1')
|
||||
text(j(6), i(35), '1')
|
||||
text(j(6), i(36), '1')
|
||||
text(j(6), i(37), '0')
|
||||
text(j(6), i(38), '0')
|
||||
text(j(6), i(39), '0')
|
||||
text(j(6), i(40), '0')
|
||||
text(j(6), i(41), '0')
|
||||
text(j(6), i(42), '0')
|
||||
|
||||
text(j(6), i(43), '0')
|
||||
text(j(6), i(44), '0')
|
||||
text(j(6), i(45), '0')
|
||||
text(j(6), i(46), '0')
|
||||
text(j(6), i(47), '0')
|
||||
text(j(6), i(48), '0')
|
||||
text(j(6), i(49), '0')
|
||||
text(j(6), i(50), '0')
|
||||
text(j(6), i(51), '-1')
|
||||
text(j(6), i(52), '-1')
|
||||
text(j(6), i(53), '-1')
|
||||
text(j(6), i(54), '-1')
|
||||
text(j(6), i(55), '-1')
|
||||
text(j(6), i(56), '-1')
|
||||
text(j(6), i(57), '-1')
|
||||
text(j(6), i(58), '-1')
|
||||
text(j(6), i(59), '-1')
|
||||
text(j(6), i(60), '-1')
|
||||
text(j(6), i(61), '-1')
|
||||
text(j(6), i(62), '-1')
|
||||
text(j(6), i(63), '-2')
|
||||
text(j(6), i(64), '-2')
|
||||
text(j(6), i(65), '-2')
|
||||
text(j(6), i(66), '-2')
|
||||
text(j(6), i(67), '-2')
|
||||
text(j(6), i(68), '-2')
|
||||
text(j(6), i(69), '-2')
|
||||
text(j(6), i(70), '-2')
|
||||
text(j(6), i(71), '-2')
|
||||
text(j(6), i(72), '-2')
|
||||
text(j(6), i(73), '-2')
|
||||
text(j(6), i(74), '-2')
|
||||
text(j(6), i(75), '-2')
|
||||
text(j(6), i(76), '-2')
|
||||
text(j(6), i(77), '-2')
|
||||
text(j(6), i(78), '-2')
|
||||
text(j(6), i(79), '-2')
|
||||
text(j(6), i(80), '-2')
|
||||
text(j(6), i(81), '-2')
|
||||
text(j(6), i(82), '-2')
|
||||
text(j(6), i(83), '-2')
|
||||
text(j(6), i(84), '-2')
|
||||
|
||||
% 7
|
||||
text(j(7), i(1), '2')
|
||||
text(j(7), i(2), '2')
|
||||
text(j(7), i(3), '2')
|
||||
text(j(7), i(4), '2')
|
||||
text(j(7), i(5), '2')
|
||||
text(j(7), i(6), '2')
|
||||
text(j(7), i(7), '2')
|
||||
text(j(7), i(8), '2')
|
||||
text(j(7), i(9), '2')
|
||||
text(j(7), i(10), '2')
|
||||
text(j(7), i(11), '2')
|
||||
text(j(7), i(12), '2')
|
||||
text(j(7), i(13), '2')
|
||||
text(j(7), i(14), '2')
|
||||
text(j(7), i(15), '2')
|
||||
text(j(7), i(16), '2')
|
||||
text(j(7), i(17), '2')
|
||||
text(j(7), i(18), '2')
|
||||
text(j(7), i(19), '2')
|
||||
text(j(7), i(20), '2')
|
||||
text(j(7), i(21), '2')
|
||||
text(j(7), i(22), '2')
|
||||
text(j(7), i(23), '1')
|
||||
text(j(7), i(24), '1')
|
||||
text(j(7), i(25), '1')
|
||||
text(j(7), i(26), '1')
|
||||
text(j(7), i(27), '1')
|
||||
text(j(7), i(28), '1')
|
||||
text(j(7), i(29), '1')
|
||||
text(j(7), i(30), '1')
|
||||
text(j(7), i(31), '1')
|
||||
text(j(7), i(32), '1')
|
||||
text(j(7), i(33), '1')
|
||||
text(j(7), i(34), '1')
|
||||
text(j(7), i(35), '0')
|
||||
text(j(7), i(36), '0')
|
||||
text(j(7), i(37), '0')
|
||||
text(j(7), i(38), '0')
|
||||
text(j(7), i(39), '0')
|
||||
text(j(7), i(40), '0')
|
||||
text(j(7), i(41), '0')
|
||||
text(j(7), i(42), '0')
|
||||
|
||||
text(j(7), i(43), '0')
|
||||
text(j(7), i(44), '0')
|
||||
text(j(7), i(45), '0')
|
||||
text(j(7), i(46), '0')
|
||||
text(j(7), i(47), '0')
|
||||
text(j(7), i(48), '0')
|
||||
text(j(7), i(49), '0')
|
||||
text(j(7), i(50), '0')
|
||||
text(j(7), i(51), '-1')
|
||||
text(j(7), i(52), '-1')
|
||||
text(j(7), i(53), '-1')
|
||||
text(j(7), i(54), '-1')
|
||||
text(j(7), i(55), '-1')
|
||||
text(j(7), i(56), '-1')
|
||||
text(j(7), i(57), '-1')
|
||||
text(j(7), i(58), '-1')
|
||||
text(j(7), i(59), '-1')
|
||||
text(j(7), i(60), '-1')
|
||||
text(j(7), i(61), '-1')
|
||||
text(j(7), i(62), '-1')
|
||||
text(j(7), i(63), '-1')
|
||||
text(j(7), i(64), '-1')
|
||||
text(j(7), i(65), '-2')
|
||||
text(j(7), i(66), '-2')
|
||||
text(j(7), i(67), '-2')
|
||||
text(j(7), i(68), '-2')
|
||||
text(j(7), i(69), '-2')
|
||||
text(j(7), i(70), '-2')
|
||||
text(j(7), i(71), '-2')
|
||||
text(j(7), i(72), '-2')
|
||||
text(j(7), i(73), '-2')
|
||||
text(j(7), i(74), '-2')
|
||||
text(j(7), i(75), '-2')
|
||||
text(j(7), i(76), '-2')
|
||||
text(j(7), i(77), '-2')
|
||||
text(j(7), i(78), '-2')
|
||||
text(j(7), i(79), '-2')
|
||||
text(j(7), i(80), '-2')
|
||||
text(j(7), i(81), '-2')
|
||||
text(j(7), i(82), '-2')
|
||||
text(j(7), i(83), '-2')
|
||||
text(j(7), i(84), '-2')
|
||||
|
||||
% 8
|
||||
text(j(8), i(1), '2')
|
||||
text(j(8), i(2), '2')
|
||||
text(j(8), i(3), '2')
|
||||
text(j(8), i(4), '2')
|
||||
text(j(8), i(5), '2')
|
||||
text(j(8), i(6), '2')
|
||||
text(j(8), i(7), '2')
|
||||
text(j(8), i(8), '2')
|
||||
text(j(8), i(9), '2')
|
||||
text(j(8), i(10), '2')
|
||||
text(j(8), i(11), '2')
|
||||
text(j(8), i(12), '2')
|
||||
text(j(8), i(13), '2')
|
||||
text(j(8), i(14), '2')
|
||||
text(j(8), i(15), '2')
|
||||
text(j(8), i(16), '2')
|
||||
text(j(8), i(17), '2')
|
||||
text(j(8), i(18), '2')
|
||||
text(j(8), i(19), '1')
|
||||
text(j(8), i(20), '1')
|
||||
text(j(8), i(21), '1')
|
||||
text(j(8), i(22), '1')
|
||||
text(j(8), i(23), '1')
|
||||
text(j(8), i(24), '1')
|
||||
text(j(8), i(25), '1')
|
||||
text(j(8), i(26), '1')
|
||||
text(j(8), i(27), '1')
|
||||
text(j(8), i(28), '1')
|
||||
text(j(8), i(29), '1')
|
||||
text(j(8), i(30), '1')
|
||||
text(j(8), i(31), '1')
|
||||
text(j(8), i(32), '1')
|
||||
text(j(8), i(33), '1')
|
||||
text(j(8), i(34), '1')
|
||||
text(j(8), i(35), '0')
|
||||
text(j(8), i(36), '0')
|
||||
text(j(8), i(37), '0')
|
||||
text(j(8), i(38), '0')
|
||||
text(j(8), i(39), '0')
|
||||
text(j(8), i(40), '0')
|
||||
text(j(8), i(41), '0')
|
||||
text(j(8), i(42), '0')
|
||||
|
||||
text(j(8), i(43), '0')
|
||||
text(j(8), i(44), '0')
|
||||
text(j(8), i(45), '0')
|
||||
text(j(8), i(46), '0')
|
||||
text(j(8), i(47), '0')
|
||||
text(j(8), i(48), '0')
|
||||
text(j(8), i(49), '0')
|
||||
text(j(8), i(50), '0')
|
||||
text(j(8), i(51), '-1')
|
||||
text(j(8), i(52), '-1')
|
||||
text(j(8), i(53), '-1')
|
||||
text(j(8), i(54), '-1')
|
||||
text(j(8), i(55), '-1')
|
||||
text(j(8), i(56), '-1')
|
||||
text(j(8), i(57), '-1')
|
||||
text(j(8), i(58), '-1')
|
||||
text(j(8), i(59), '-1')
|
||||
text(j(8), i(60), '-1')
|
||||
text(j(8), i(61), '-1')
|
||||
text(j(8), i(62), '-1')
|
||||
text(j(8), i(63), '-1')
|
||||
text(j(8), i(64), '-1')
|
||||
text(j(8), i(65), '-1')
|
||||
text(j(8), i(66), '-1')
|
||||
text(j(8), i(67), '-2')
|
||||
text(j(8), i(68), '-2')
|
||||
text(j(8), i(69), '-2')
|
||||
text(j(8), i(70), '-2')
|
||||
text(j(8), i(71), '-2')
|
||||
text(j(8), i(72), '-2')
|
||||
text(j(8), i(73), '-2')
|
||||
text(j(8), i(74), '-2')
|
||||
text(j(8), i(75), '-2')
|
||||
text(j(8), i(76), '-2')
|
||||
text(j(8), i(77), '-2')
|
||||
text(j(8), i(78), '-2')
|
||||
text(j(8), i(79), '-2')
|
||||
text(j(8), i(80), '-2')
|
||||
text(j(8), i(81), '-2')
|
||||
text(j(8), i(82), '-2')
|
||||
text(j(8), i(83), '-2')
|
||||
text(j(8), i(84), '-2')
|
||||
|
||||
orient('landscape')
|
||||
print -dpng 'pd_csa.png'
|
||||
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -207,7 +207,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
// Output Results
|
||||
RQ = N/D;
|
||||
RQ = flr(N/D, prec);
|
||||
// Since q_{computed} = q / radix, multiply by radix
|
||||
RD = Q * radix;
|
||||
printf("true = %1.18lf, computed = %1.18lf, \n", RQ, RD);
|
||||
|
Loading…
Reference in New Issue
Block a user