-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPolinom.m
More file actions
27 lines (27 loc) · 798 Bytes
/
Polinom.m
File metadata and controls
27 lines (27 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% Check our mathematical part with simple and intresting polinom
function [] = Polinom(bitBudget)
t = 0:0.00001:1;
s = (1/16)*(231*t.^6-315*t.^4+105*t.^2-5);
[bNumerical,NNumerical] = polinomNumerically(bitBudget);
qss = sampleAndQuantize(s,bitBudget,1);
mse = mseProject(s,qss);
min_b = 1;
for b=2:1:16,
tempQss = sampleAndQuantize(s,floor(bitBudget/b),b);
tempMse = mseProject(s,tempQss);
if tempMse<mse,
qss = tempQss;
mse = tempMse;
min_b = b;
end
end
qss = decompress_1d(qss,numel(t));
figure;
plot(t,s);
figure;
plot(t,qss);
fprintf('Exhausted Serch Optimal b : %d \n',min_b);
fprintf('Exhausted Serch Optimal N : %d \n',floor(bitBudget/min_b));
fprintf('Numerical Optimal b : %d \n',bNumerical);
fprintf('Numerical Optimal N : %d \n',NNumerical);
end