Skip to content

Commit 7a54b16

Browse files
committed
Added Polinom
1 parent 5bf0e1b commit 7a54b16

9 files changed

Lines changed: 70 additions & 47 deletions

CheckPhiDependency1.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
B = 2048;
77
omega = rand * 10 + epsilon;
88
floor_omega = ceil(omega);
9+
phi = rand*2*pi;
910
[b_org,N_org,] = func1Numerically(omega,phi,A,B);
1011
[b_org_floor,N_org_floor,] = func1Numerically(floor_omega,phi,A,B);
1112
for j=1:1:10,

CheckPhiDependency1.m~

Lines changed: 0 additions & 18 deletions
This file was deleted.

CheckPhiDependency3.m~

Lines changed: 0 additions & 28 deletions
This file was deleted.

Polinom.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
% Check our mathematical part with simple and intresting polinom
2+
function [] = Polinom(bitBudget)
3+
t = 0:0.00001:1;
4+
s = (1/16)*(231*t.^6-315*t.^4+105*t.^2-5);
5+
[bNumerical,NNumerical] = polinomNumerically(bitBudget);
6+
qss = sampleAndQuantize(s,bitBudget,1);
7+
mse = mseProject(s,qss);
8+
min_b = 1;
9+
for b=2:1:16,
10+
tempQss = sampleAndQuantize(s,floor(bitBudget/b),b);
11+
tempMse = mseProject(s,tempQss);
12+
if tempMse<mse,
13+
qss = tempQss;
14+
mse = tempMse;
15+
min_b = b;
16+
end
17+
end
18+
qss = decompress_1d(qss,numel(t));
19+
figure;
20+
plot(t,s);
21+
figure;
22+
plot(t,qss);
23+
fprintf('Exhausted Serch Optimal b : %d \n',min_b);
24+
fprintf('Exhausted Serch Optimal N : %d \n',floor(bitBudget/min_b));
25+
fprintf('Numerical Optimal b : %d \n',bNumerical);
26+
fprintf('Numerical Optimal N : %d \n',NNumerical);
27+
end

Polinom.m~

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function [ s ] = Polinom(bitBudget)
2+
t = 0:0.00001:1;
3+
s = (1/16)*(231*t.^6-315*t.^4+105*t.^2-5);
4+
[bNumerical,NNumerical] = polinomNumerically(bitBudget);
5+
qss = sampleAndQuantize(s,bitBudget,1);
6+
mse = mseProject(s,qss);
7+
min_b = 1;
8+
for b=2:1:16,
9+
tempQss = sampleAndQuantize(s,floor(bitBudget/b),b);
10+
tempMse = mseProject(s,tempQss);
11+
if tempMse<mse,
12+
qss = tempQss;
13+
mse = tempMse;
14+
min_b = b;
15+
end
16+
end
17+
qss = decompress_1d(qss,numel(t));
18+
figure;
19+
plot(t,s);
20+
figure;
21+
plot(handles.axes2,t_grid,qss);
22+
fprintf('Exhausted Serch Optimal b : %d \n',min_b);
23+
fprintf('Exhausted Serch Optimal N : %d \n',floor(bitBudget/min_b));
24+
fprintf('Numerical Optimal b : %d \n',bNumerical);
25+
fprintf('Numerical Optimal N : %d \n',NNumerical);
26+
end

func5Numerically.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
syms symb;
44
fun = @(t) (2.*pi.*(beta.*t+A).*(omega+2.*alpha.*t).*cos(2.*pi.*t.*(omega+alpha.*t)+phi)+beta.*sin(2.*pi.*t.*(omega+alpha.*t)+phi)).^2;
55
Energy = integral(fun,0,1);
6-
range = 2*beta*(beta+A);
6+
range = 2*(beta+A);
77
b = double(solve(Energy/(6*B^2)*symb-log(2)*range^2/(6*2^(2*symb)),symb));
88
N = B/b;
99
mse = Energy/(12*N^2)+range^2/(12*2^(2*b));

gui.fig

-112 KB
Binary file not shown.

polinomNumerically.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
% Numerical calculation of N,b and the mse of function 1
2+
function [b,N] = polinomNumerically(B)
3+
syms symb;
4+
b = double(solve(((symb/(6*B^2))*21-log(2)/6*(4/(2^(2*symb)))),symb));
5+
N = B/b;
6+
end
7+

polinomNumerically.m~

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
% Numerical calculation of N,b and the mse of function 1
2+
function [b,N] = polinomNumerically(B)
3+
syms symb;
4+
double(solve(Energy/(6*B^2)*symb-log(2)*range^2/(6*2^(2*symb)),symb));
5+
b = double(solve(symb/(6*B^2)*21-ln?(2)/6*(4/(2^(2*symb))),symb));
6+
N = B/b;
7+
end
8+

0 commit comments

Comments
 (0)