how i solve these lagranges equations,and generate polynomail
1 view (last 30 days)
Show older comments
In creating shares following steps are performed. Sir please tell in deatil initialize random coefficients r = round(100*(2*rand(1,k-1)-1)); r(r==0) = 1; generate the polynomial about x with k unknowns P = @(x) (x.^(1:k-1))*r'+s; generate n pieces of partial information i = 1:n d(i,1) = i; d(i,2) = P(i); and obtain k pieces of info x = d(1:k,1)'; y = d(1:k,2)';
generate Largrange Polynomial
delElement = @(x,i) [x(1:i-1),x(i+1:end)];
lj = @(a,j) prod(delElement(a-x,j)'./delElement(x(j)-x,j)');
Lj = @(y,j) y(j)*lj(0,j);
reconstruct secret info
s = 0;
i = 1:k
s = s+Lj(y,i);
0 Comments
Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!