% verify sol'n by displaying a slenderized comparagram Jverify % compute f(q) vs f(kq) function Jverify=clshow(Finv,k_in); if (nargin < 2) error("example use: Jverify=clshow(Finv,2)\n"); end%if if (nargout < 1) error("example use: Jverify=clshow(Finv,2)\n"); end%if disp("showing slenderized comparagram (for verifying result)"); fflush(1); n=length(Finv); % k=exp(k_in); % should not be set to e^k % k=2..^k_in; % this should not be required; SOMETHING IS WRONG HERE!!!! k=k_in; Jverify=zeros(n); %finv = exp(Finv); finv = 2..^Finv; for i=1:n kq= k*finv(i); % j1 is from going up; j2 from going down % nearest neighbour search rather than binary search (easier to implement) j1= 1; while ((kq>=finv(j1))&&(j1<256)) ; j1=j1+1; end j2=256; while ((kq<=finv(j2))&&(j2> 1)) ; j2=j2-1; end j = (j1+j2)/2; %disp(sprintf('kq=% 15.10f i=%03d, j=%03d',kq,i,j)); Jverify(i,j)=255; end%for %tvs(Jverify); end