Cody

Problem 1305. Creation of 2D Sinc Surface

Solution 1202115

Submitted on 1 Jun 2017
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
nrc=65; xymax=3; freq=1; m=sinx_div_x(xymax,nrc,freq); %figure(3);imagesc(m) %figure(4);surf(m) xv=repmat(-xymax:2*xymax/(nrc-1):xymax,nrc,1); yv=xv'; mexp=zeros(nrc); for r=1:nrc for c=1:nrc Rv=sqrt(xv(r,c)^2+yv(r,c)^2); if Rv>eps mexp(r,c)=sin(Rv*pi*freq)/(Rv*pi*freq); else mexp(r,c)=1; end end % c end %r %figure(1);imagesc(mexp) %figure(2);surf(mexp) assert(~any(any(isnan(m)))) assert(max(max(abs(m-mexp)))<.01)

Undefined function 'sinc' for input arguments of type 'double'. Error in sinx_div_x (line 3) sinc(freq*hypot(ans,ans')); Error in TestPoint1 (line 5) m=sinx_div_x(xymax,nrc,freq);

2   Fail
nrc=127; xymax=3; freq=4; m=sinx_div_x(xymax,nrc,freq); %figure(3);imagesc(m) %figure(4);surf(m) xv=repmat(-xymax:2*xymax/(nrc-1):xymax,nrc,1); yv=xv'; mexp=zeros(nrc); for r=1:nrc for c=1:nrc Rv=sqrt(xv(r,c)^2+yv(r,c)^2); if Rv>eps mexp(r,c)=sin(Rv*pi*freq)/(Rv*pi*freq); else mexp(r,c)=1; end end % c end %r %figure(1);imagesc(mexp) %figure(2);surf(mexp) assert(~any(any(isnan(m)))) assert(max(max(abs(m-mexp)))<.01)

Undefined function 'sinc' for input arguments of type 'double'. Error in sinx_div_x (line 3) sinc(freq*hypot(ans,ans')); Error in TestPoint2 (line 5) m=sinx_div_x(xymax,nrc,freq);

3   Fail
nrc=96; xymax=16; freq=0.5; m=sinx_div_x(xymax,nrc,freq); %figure(3);imagesc(m) %figure(4);surf(m) xv=repmat(-xymax:2*xymax/(nrc-1):xymax,nrc,1); yv=xv'; mexp=zeros(nrc); for r=1:nrc for c=1:nrc Rv=sqrt(xv(r,c)^2+yv(r,c)^2); if Rv>eps mexp(r,c)=sin(Rv*pi*freq)/(Rv*pi*freq); else mexp(r,c)=1; end end % c end %r %figure(1);imagesc(mexp) %figure(2);surf(mexp) assert(~any(any(isnan(m)))) assert(max(max(abs(m-mexp)))<.01)

Undefined function 'sinc' for input arguments of type 'double'. Error in sinx_div_x (line 3) sinc(freq*hypot(ans,ans')); Error in TestPoint3 (line 5) m=sinx_div_x(xymax,nrc,freq);