Cody

Solution 1605028

Submitted on 9 Aug 2018
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)

m = Columns 1 through 17 -0.0025 -0.0154 0.0209 -0.0072 -0.0144 0.0218 -0.0047 -0.0191 0.0190 0.0078 -0.0241 0.0025 0.0242 -0.0077 -0.0242 0.0071 0.0259 -0.0154 0.0212 -0.0101 -0.0105 0.0224 -0.0125 -0.0114 0.0235 -0.0070 -0.0197 0.0195 0.0105 -0.0245 -0.0038 0.0260 0.0029 -0.0264 0.0209 -0.0101 -0.0090 0.0220 -0.0165 -0.0049 0.0226 -0.0167 -0.0091 0.0248 -0.0077 -0.0214 0.0184 0.0156 -0.0230 -0.0134 0.0234 -0.0072 -0.0105 0.0220 -0.0177 -0.0013 0.0204 -0.0213 0.0005 0.0221 -0.0197 -0.0080 0.0262 -0.0063 -0.0245 0.0146 0.0225 -0.0165 -0.0144 0.0224 -0.0165 -0.0013 0.0194 -0.0228 0.0064 0.0172 -0.0245 0.0049 0.0218 -0.0216 -0.0090 0.0275 -0.0019 -0.0281 0.0062 0.0218 -0.0125 -0.0049 0.0204 -0.0228 0.0083 0.0141 -0.0255 0.0131 0.0137 -0.0267 0.0079 0.0225 -0.0223 -0.0126 0.0280 0.0065 -0.0047 -0.0114 0.0226 -0.0213 0.0064 0.0141 -0.0254 0.0168 0.0074 -0.0261 0.0186 0.0107 -0.0285 0.0089 0.0249 -0.0208 -0.0193 -0.0191 0.0235 -0.0167 0.0005 0.0172 -0.0255 0.0168 0.0052 -0.0245 0.0234 0.0006 -0.0257 0.0226 0.0093 -0.0303 0.0070 0.0290 0.0190 -0.0070 -0.0091 0.0221 -0.0245 0.0131 0.0074 -0.0245 0.0246 -0.0045 -0.0212 0.0280 -0.0051 -0.0254 0.0252 0.0106 -0.0321 0.0078 -0.0197 0.0248 -0.0197 0.0049 0.0137 -0.0261 0.0234 -0.0045 -0.0193 0.0292 -0.0135 -0.0168 0.0311 -0.0091 -0.0264 0.0260 -0.0241 0.0195 -0.0077 -0.0080 0.0218 -0.0267 0.0186 0.0006 -0.0212 0.0292 -0.0161 -0.0114 0.0308 -0.0209 -0.0129 0.0335 -0.0104 0.0025 0.0105 -0.0214 0.0262 -0.0216 0.0079 0.0107 -0.0257 0.0280 -0.0135 -0.0114 0.0300 -0.0256 -0.0027 0.0306 -0.0264 -0.0111 0.0242 -0.0245 0.0184 -0.0063 -0.0090 0.0225 -0.0285 0.0226 -0.0051 -0.0168 0.0308 -0.0256 0.0009 0.0269 -0.0324 0.0051 0.0304 -0.0077 -0.0038 0.0156 -0.0245 0.0275 -0.0223 0.0089 0.0093 -0.0254 0.0311 -0.0209 -0.0027 0.0269 -0.0336 0.0131 0.0215 -0.0370 -0.0242 0.0260 -0.0230 0.0146 -0.0019 -0.0126 0.0249 -0.0303 0.0252 -0.0091 -0.0129 0.0306 -0.0324 0.0131 0.0179 -0.0373 0.0237 0.0071 0.0029 -0.0134 0.0225 -0.0281 0.0280 -0.0208 0.0070 0.0106 -0.0264 0.0335 -0.0264 0.0051 0.0215 -0.0373 0.0274 0.0065 0.0259 -0.0264 0.0234 -0.0165 0.0062 0.0065 -0.0193 0.0290 -0.0321 0.0260 -0.0104 -0.0111 0.0304 -0.0370 0.0237 0.0065 -0.0355 0.0006 -0.0090 0.0173 -0.0244 0.0290 -0.0296 0.0252 -0.0153 0.0009 0.0155 -0.0296 0.0360 -0.0300 0.0107 0.0163 -0.0379 0.0383 -0.0258 0.0234 -0.0186 0.0115 -0.0022 -0.0084 0.0192 -0.0282 0.0334 -0.0324 0.0238 -0.0077 -0.0129 0.0318 -0.0406 0.0318 -0.0047 -0.0154 0.0210 -0.0257 0.0290 -0.0301 0.0284 -0.0234 0.0147 -0.0029 -0.0111 0.0249 -0.0353 0.0385 -0.0313 0.0126 0.0136 -0.0377 0.0146 -0.0096 0.0034 0.0036 -0.0114 0.0192 -0.0264 0.0319 -0.0347 0.0335 -0.0271 0.0153 0.0013 -0.0201 0.0366 -0.0444 0.0373 0.0276 -0.0283 0.0280 -0.0263 0.0231 -0.0182 0.0114 -0.0029 -0.0071 0.0179 -0.0282 0.0365 -0.0406 0.0383 -0.0276 0.0085 0.0164 0.0130 -0.0172 0.0214 -0.0254 0.0290 -0.0318 0.0335 -0.0336 0.0317 -0.0271 0.0196 -0.0091 -0.0042 0.0192 -0.0339 0.0449 -0.0480 -0.0120 0.0089 -0.0051 0.0008 0.0041 -0.0096 0.0155 -0.0217 0.0278 -0.0334 0.0380 -0.0406 0.0404 -0.0363 0.0274 -0.0130 -0.0062 -0.0272 0.0270 -0.0263 0.0252 -0.0234 0.0209 -0.0175 0.0131 -0.0077 0.0012 0.0065 -0.0151 0.0244 -0.0339 0.0424 -0.0486 0.0505 -0.0257 0.0274 -0.0292 0.0308 -0.0323 0.0335 -0.0344 0.0348 -0.0346 0.0335 -0.0313 0.0277 -0.0224 0.0151 -0.0056 -0.0062 0.0201 -0.0126 0.0146 -0.0168 0.0192 -0.0217 0.0245 -0.0273 0.0304 -0.0334 0.0365 -0.0395 0.0422 -0.0444 0.0458 -0.0459 0.0442 -0.0399 0.0034 -0.0022 0.0008 0.0008 -0.0027 0.0048 -0.0071 0.0098 -0.0129 0.0163 -0.0201 0.0244 -0.0292 0.0344 -0.0401 0.0459 -0.0518 0.0164 -0.0161 0.0158 -0.0153 0.0147 -0.0140 0.0131 -0.0121 0.0107 -0.0091 0.0071 -0.0047 0.0017 0.0019 -0.0062 0.0114 -0.0177 0.0243 -0.0247 0.0252 -0.0256 0.0260 -0.0264 0.0268 -0.0271 0.0274 -0.0276 0.0277 -0.0276 0.0274 -0.0269 0.0261 -0.0248 0.0230 0.0280 -0.0288 0.0296 -0.0305 0.0314 -0.0324 0.0335 -0.0346 0.0357 -0.0370 0.0383 -0.0396 0.0411 -0.0426 0.0442 -0.0458 0.0475 0.0292 -0.0301 0.0311 -0.0321 0.0332 -0.0344 0.0357 -0.0370 0.0385 -0.0401 0.0418 -0.0437 0.0458 -0.0480 0.0505 -0.0533 0.0563 0.0294 -0.0303 0.0313 -0.0324 0.0335 -0.0347 0.0360 -0.0374 0.0390 -0.0406 0.0424 -0.0444 0.0466 -0.0489 0.0516 -0.0545 0.0578 0.0294 -0.0303 0.0313 -0.0324 0.0335 -0.0347 0.0360 -0.0374 0.0390 -0.0406 0.0424 -0.0444 0.0466 -0.0489 0.0516 -0.0545 0.0578 0.0292 -0.0301 0.0311 -0.0321 0.0332 -0.0344 0.0357 -0.0370 0.0385 -0.0401 0.0418 -0.0437 0.0458 -0.0480 0.0505 -0.0533 0.0563 0.0280 -0.0288 0.0296 -0.0305 0.0314 -0.0324 0.0335 -0.0346 0.0357 -0.0370 0.0383 -0.0396 0.0411 -0.0426 0.0442 -0.0458 0.0475 0.0243 -0.0247 0.0252 -0.0256 0.0260 -0.0264 0.0268 -0.0271 0.0274 -0.0276 0.0277 -0.0276 0.0274 -0.0269 0.0261 -0.0248 0.0230 0.0164 -0.0161 0.0158 -0.0153 0.0147 -0.0140 0.0131 -0.0121 0.0107 -0.0091 0.0071 -0.0047 0.0017 0.0019 -0.0062 0.0114 -0.0177 0.0034 -0.0022 0.0008 0.0008 -0.0027 0.0048 -0.0071 0.0098 -0.0129 0.0163 -0.0201 0.0244 -0.0292 0.0344 -0.0401 0.0459 -0.0518 -0.0126 0.0146 -0.0168 0.0192 -0.0217 0.0245 -0.0273 0.0304 -0.0334 0.0365 -0.0395 0.0422 -0.0444 0.0458 -0.0459 0.0442 -0.0399 -0.0257 0.0274 -0.0292 0.0308 -0.0323 0.0335 -0.0344 0.0348 -0.0346 0.0335 -0.0313 0.0277 -0.0224 0.0151 -0.0056 -0.0062 0.0201 -0.0272 0.0270 -0.0263 0.0252 -0.0234 0.0209 -0.0175 0.0131 -0.0077 0.0012 0.0065 -0.0151 0.0244 -0.0339 0.0424 -0.0486 0.0505 -0.0120 0.0089 -0.0051 0.0008 0.0041 -0.0096 0.0155 -0.0217 0.0278 -0.0334 0.0380 -0.0406 0.0404 -0.0363 0.0274 -0.0130 -0.0062 0.0130 -0.0172 0.0214 -0.0254 0.0290 -0.0318 0.0335 -0.0336 0.0317 -0.0271 0.0196 -0.0091 -0.0042 0.0192 -0.0339 0.0449 -0.0480 0.0276 -0.0283 0.0280 -0.0263 0.0231 -0.0182 0.0114 -0.0029 -0.0071 0.0179 -0.0282 0.0365 -0.0406 0.0383 -0.0276 0.0085 0.0164 0.0146 -0.0096 0.0034 0.0036 -0.0114 0.0192 -0.0264 0.0319 -0.0347 0.0335 -0.0271 0.0153 0.0013 -0.0201 0.0366 -0.0444 0.0373 -0.0154 0.0210 -0.0257 0.0290 -0.0301 0.0284 -0.0234 0.0147 -0.0029 -0.0111 0.0249 -0.0353 0.0385 -0.0313 0.0126 0.0136 -0.0377 -0.0258 0.0234 -0.0186 0.0115 -0.0022 -0.0084 0.0192 -0.0282 0.0334 -0.0324 0.0238 -0.0077 -0.0129 0.0318 -0.0406 0.0318 -0.0047 0.0006 -0.0090 0.0173 -0.0244 0.0290 -0.0296 0.0252 -0.0153 0.0009 0.0155 -0.0296 0.0360 -0.0300 0.0107 0.0163 -0.0379 0.0383 0.0259 -0.0264 0.0234 -0.0165 0.0062 0.0065 -0.0193 0.0290 -0.0321 0.0260 -0.0104 -0.0111 0.0304 -0.0370 0.0237 0.0065 -0.0355 0.0071 0.0029 -0.0134 0.0225 -0.0281 0.0280 -0.0208 0.0070 0.0106 -0.0264 0.0335 -0.0264 0.0051 0.0215 -0.0373 0.0274 0.0065 -0.0242 0.0260 -0.0230 0.0146 -0.0019 -0.0126 0.0249 -0.0303 0.0252 -0.0091 -0.0129 0.0306 -0.0324 0.0131 0.0179 -0.0373 0.0237 -0.0077 -0.0038 0.0156 -0.0245 0.0275 -0.0223 0.0089 0.0093 -0.0254 0.0311 -0.0209 -0.0027 0.0269 -0.0336 0.0131 0.0215 -0.0370 0.0242 -0.0245 0.0184 -0.0063 -0.0090 0.0225 -0.0285 0.0226 -0.0051 -0.0168 0.0308 -0.0256 0.0009 0.0269 -0.0324 0.0051 0.0304 0.0025 0.0105 -0.0214 0.0262 -0.0216 0.0079 0.0107 -0.0257 0.0280 -0.0135 -0.0114 0.0300 -0.0256 -0.0027 0.0306 -0.0264 -0.0111 -0.0241 0.0195 -0.0077 -0.0080 0.0218 -0.0267 0.0186 0.0006 -0.0212 0.0292 -0.0161 -0.0114 0.0308 -0.0209 -0.0129 0.0335 -0.0104 0.0078 -0.0197 0.0248 -0.0197 0.0049 0.0137 -0.0261 0.0234 -0.0045 -0.0193 0.0292 -0.0135 -0.0168 0.0311 -0.0091 -0.0264 0.0260 0.0190 -0.0070 -0.0091 0.0221 -0.0245 0.0131 0.0074 -0.0245 0.0246 -0.0045 -0.0212 0.0280 -0.0051 -0.0254 0.0252 0.0106 -0.0321 -0.0191 0.0235 -0.0167 0.0005 0.0172 ...

Matrix dimensions must agree. Error in Test1 (line 28) assert(max(max(abs(m-mexp)))<.01)

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)

m = Columns 1 through 17 -0.0016 0.0025 -0.0026 0.0014 0.0007 -0.0025 0.0024 -0.0001 -0.0025 0.0022 0.0012 -0.0028 -0.0003 0.0029 0.0005 -0.0028 -0.0018 0.0025 -0.0027 0.0020 -0.0005 -0.0014 0.0027 -0.0022 -0.0001 0.0025 -0.0023 -0.0008 0.0029 -0.0006 -0.0029 0.0008 0.0030 0.0001 -0.0026 0.0020 -0.0009 -0.0007 0.0022 -0.0028 0.0019 0.0005 -0.0026 0.0024 0.0005 -0.0029 0.0013 0.0025 -0.0019 -0.0024 0.0016 0.0014 -0.0005 -0.0007 0.0019 -0.0027 0.0026 -0.0012 -0.0011 0.0028 -0.0023 -0.0004 0.0029 -0.0017 -0.0020 0.0026 0.0015 -0.0026 0.0007 -0.0014 0.0022 -0.0027 0.0027 -0.0019 0.0002 0.0018 -0.0029 0.0021 0.0006 -0.0029 0.0020 0.0015 -0.0030 -0.0005 0.0031 -0.0025 0.0027 -0.0028 0.0026 -0.0019 0.0007 0.0010 -0.0025 0.0029 -0.0017 -0.0009 0.0029 -0.0021 -0.0012 0.0031 -0.0004 -0.0031 0.0024 -0.0022 0.0019 -0.0012 0.0002 0.0010 -0.0022 0.0029 -0.0026 0.0010 0.0015 -0.0030 0.0021 0.0011 -0.0031 0.0011 0.0027 -0.0001 -0.0001 0.0005 -0.0011 0.0018 -0.0025 0.0029 -0.0028 0.0018 0.0001 -0.0021 0.0031 -0.0019 -0.0011 0.0032 -0.0015 -0.0023 -0.0025 0.0025 -0.0026 0.0028 -0.0029 0.0029 -0.0026 0.0018 -0.0004 -0.0013 0.0028 -0.0030 0.0014 0.0014 -0.0032 0.0017 0.0020 0.0022 -0.0023 0.0024 -0.0023 0.0021 -0.0017 0.0010 0.0001 -0.0013 0.0025 -0.0031 0.0026 -0.0007 -0.0019 0.0032 -0.0017 -0.0018 0.0012 -0.0008 0.0005 -0.0004 0.0006 -0.0009 0.0015 -0.0021 0.0028 -0.0031 0.0028 -0.0017 -0.0004 0.0025 -0.0032 0.0015 0.0017 -0.0028 0.0029 -0.0029 0.0029 -0.0029 0.0029 -0.0030 0.0031 -0.0030 0.0026 -0.0017 0.0002 0.0017 -0.0031 0.0031 -0.0011 -0.0019 -0.0003 -0.0006 0.0013 -0.0017 0.0020 -0.0021 0.0021 -0.0019 0.0014 -0.0007 -0.0004 0.0017 -0.0028 0.0033 -0.0025 0.0003 0.0024 0.0029 -0.0029 0.0025 -0.0020 0.0015 -0.0012 0.0011 -0.0011 0.0014 -0.0019 0.0025 -0.0031 0.0033 -0.0029 0.0015 0.0008 -0.0029 0.0005 0.0008 -0.0019 0.0026 -0.0030 0.0031 -0.0031 0.0032 -0.0032 0.0032 -0.0032 0.0031 -0.0025 0.0015 0.0002 -0.0020 0.0034 -0.0028 0.0030 -0.0024 0.0015 -0.0005 -0.0004 0.0011 -0.0015 0.0017 -0.0017 0.0015 -0.0011 0.0003 0.0008 -0.0020 0.0031 -0.0035 -0.0018 0.0001 0.0016 -0.0026 0.0031 -0.0031 0.0027 -0.0023 0.0020 -0.0018 0.0017 -0.0019 0.0024 -0.0029 0.0034 -0.0035 0.0029 0.0016 -0.0029 0.0030 -0.0020 0.0006 0.0008 -0.0019 0.0027 -0.0031 0.0033 -0.0033 0.0034 -0.0034 0.0033 -0.0031 0.0024 -0.0012 0.0030 -0.0021 0.0001 0.0019 -0.0030 0.0032 -0.0026 0.0017 -0.0007 -0.0001 0.0008 -0.0011 0.0013 -0.0011 0.0007 0.0001 -0.0012 0.0015 0.0010 -0.0028 0.0031 -0.0019 0.0001 0.0016 -0.0028 0.0033 -0.0033 0.0031 -0.0027 0.0025 -0.0024 0.0025 -0.0028 0.0033 -0.0011 0.0030 -0.0027 0.0006 0.0017 -0.0031 0.0032 -0.0022 0.0007 0.0008 -0.0019 0.0027 -0.0031 0.0034 -0.0035 0.0035 -0.0034 -0.0028 0.0027 -0.0003 -0.0023 0.0033 -0.0022 0.0001 0.0020 -0.0032 0.0034 -0.0029 0.0019 -0.0010 0.0002 0.0004 -0.0006 0.0006 -0.0031 0.0009 0.0021 -0.0032 0.0017 0.0010 -0.0030 0.0033 -0.0020 0.0001 0.0017 -0.0030 0.0035 -0.0036 0.0034 -0.0032 0.0031 -0.0023 -0.0010 0.0032 -0.0021 -0.0010 0.0032 -0.0029 0.0007 0.0018 -0.0033 0.0034 -0.0023 0.0008 0.0007 -0.0019 0.0027 -0.0032 -0.0013 -0.0023 0.0030 -0.0001 -0.0029 0.0030 -0.0004 -0.0024 0.0035 -0.0024 0.0001 0.0021 -0.0034 0.0037 -0.0031 0.0022 -0.0013 -0.0004 -0.0030 0.0022 0.0016 -0.0034 0.0013 0.0021 -0.0035 0.0019 0.0010 -0.0032 0.0035 -0.0022 0.0001 0.0018 -0.0032 0.0038 0.0002 -0.0032 0.0013 0.0026 -0.0029 -0.0005 0.0033 -0.0025 -0.0008 0.0034 -0.0032 0.0008 0.0020 -0.0036 0.0037 -0.0025 0.0009 0.0003 -0.0033 0.0007 0.0031 -0.0021 -0.0019 0.0034 -0.0006 -0.0029 0.0034 -0.0007 -0.0025 0.0038 -0.0026 0.0001 0.0023 -0.0037 0.0000 -0.0033 0.0004 0.0033 -0.0015 -0.0027 0.0029 0.0010 -0.0036 0.0019 0.0019 -0.0038 0.0022 0.0010 -0.0035 0.0038 -0.0024 -0.0007 -0.0033 0.0007 0.0033 -0.0012 -0.0031 0.0023 0.0021 -0.0035 0.0001 0.0034 -0.0030 -0.0006 0.0035 -0.0035 0.0009 0.0021 -0.0018 -0.0030 0.0013 0.0032 -0.0014 -0.0031 0.0020 0.0027 -0.0030 -0.0013 0.0038 -0.0013 -0.0028 0.0038 -0.0010 -0.0026 0.0041 -0.0029 -0.0022 0.0023 0.0028 -0.0020 -0.0030 0.0021 0.0028 -0.0027 -0.0020 0.0036 0.0002 -0.0038 0.0025 0.0017 -0.0041 0.0026 -0.0033 -0.0005 0.0033 0.0017 -0.0028 -0.0024 0.0026 0.0026 -0.0028 -0.0023 0.0034 0.0012 -0.0039 0.0009 0.0034 -0.0035 -0.0002 -0.0022 0.0018 0.0033 -0.0001 -0.0035 -0.0012 0.0033 0.0019 -0.0031 -0.0021 0.0034 0.0016 -0.0039 -0.0002 0.0040 -0.0021 -0.0025 0.0008 0.0034 0.0017 -0.0024 -0.0032 0.0008 0.0037 0.0006 -0.0037 -0.0013 0.0036 0.0014 -0.0038 -0.0008 0.0041 -0.0009 -0.0037 0.0033 0.0023 -0.0014 -0.0036 -0.0012 0.0029 0.0030 -0.0014 -0.0038 0.0001 0.0039 0.0007 -0.0040 -0.0007 0.0042 -0.0002 -0.0042 0.0021 -0.0014 -0.0035 -0.0019 0.0021 0.0036 0.0006 -0.0034 -0.0027 0.0021 0.0037 -0.0008 -0.0041 0.0001 0.0042 -0.0002 -0.0043 -0.0023 -0.0035 -0.0015 0.0021 0.0036 0.0013 -0.0027 -0.0035 0.0001 0.0038 0.0022 -0.0027 -0.0035 0.0016 0.0041 -0.0009 -0.0043 -0.0027 0.0001 0.0030 0.0034 0.0007 -0.0028 -0.0036 -0.0006 0.0032 0.0033 -0.0008 -0.0041 -0.0017 0.0033 0.0032 -0.0023 -0.0040 0.0025 0.0035 0.0021 -0.0010 -0.0035 -0.0031 0.0001 0.0034 0.0034 -0.0002 -0.0037 -0.0030 0.0016 0.0042 0.0010 -0.0039 -0.0028 0.0017 -0.0010 -0.0032 -0.0034 -0.0013 0.0020 0.0038 0.0026 -0.0010 -0.0038 -0.0030 0.0010 0.0041 0.0025 -0.0023 -0.0043 -0.0003 -0.0035 -0.0029 -0.0006 0.0021 0.0037 0.0030 0.0002 -0.0029 -0.0039 -0.0019 0.0019 0.0042 0.0025 -0.0019 -0.0044 -0.0019 0.0031 0.0018 0.0034 0.0035 0.0019 -0.0007 -0.0031 -0.0038 -0.0022 0.0009 0.0036 0.0038 0.0010 -0.0028 -0.0043 -0.0018 0.0027 0.0045 0.0010 -0.0012 -0.0030 -0.0037 -0.0028 -0.0006 0.0021 0.0038 0.0035 0.0011 -0.0021 -0.0042 -0.0033 0.0001 0.0037 0.0042 0.0009 -0.0029 -0.0013 0.0008 0.0027 0.0038 0.0034 0.0016 -0.0010 -0.0033 -0.0041 -0.0028 0.0002 0.0033 0.0044 0.0025 -0.0013 -0.0044 0.0035 0.0028 0.0013 -0.0007 -0.0026 -0.0038 -0.0037 -0.0023 0.0001 0.0026 0.0041 0.0038 0.0015 -0.0017 -0.0042 -0.0042 -0.0014 -0.0036 -0.0034 -0.0025 -0.0009 0.0010 0.0027 0.0038 0.0039 0.0027 0.0005 -0.0020 -0.0039 -0.0043 -0.0028 0.0001 0.0032 0.0047 0.0036 0.0036 0.0030 0.0018 0.0002 -0.0016 -0.0031 -0.0040 -0.0039 -0.0028 -0.0007 0.0017 0.0037 0.0045 0.0036 0.0012 -0.0020 -0.0036 -0.0036 -0.0031 -0.0021 -0.0007 0.0009 0.0025 0.0036 0.0041 0.0038 0.0025 0.0005 -0.0017 -0.0037 -0.0046 -0.0041 -0.0020 0.0036 0.0034 0.0027 0.0017 0.0004 -0.0010 -0.0024 -0.0035 -0.0041 -0.0041 -0.0033 -0.0018 0.0001 0.0022 0.0039 0.0047 0.0042 -0.0031 -0.0025 -0.0016 -0.0006 0.0006 0.0018 0.0029 0.0037 0.0042 0.0041 0.0034 0.0022 0.0006 -0.0013 -0.0031 -0.0044 -0.0048 0.0014 0.0006 -0.0004 -0.0013 -0.0023 -0.0031 -0.0037 -0.0041 -0.0041 -0.0037 -0.0029 -0.0018 -0.0003 0.0014 0.0029 0.0042 0.0048 0.0015 0.0022 0.0028 0.0034 0.0038 0.0040 0.0040 0.0038 0.0033 0.0025 0.0015 0.0003 -0.0010 -0.0024 -0.0036 -0.0044 -0.0049 -0.0037 -0.0038 -0.0038 -0.0036 -0.0034 -0.0029 -0.0024 -0.0017 -0.0008 0.0001 0.0011 0.0021 0.0031 0.0039 0.0045 0.0048 0.0047 0.0019 0.0015 0.0010 0.0004 -0.0002 -0.0008 -0.0015 -0.0021 -0.0028 -0.0034 -0.0039 -0.0043 -0.0045 -0.0046 -0.0044 -0.0040 -0.0033 0.0028 0.0031 0.0034 0.0036 0.0038 0.0040 0.0041 0.0041 0.0041 0.0039 0.0037 0.0033 0.0028 0.0022 0.0015 0.0007 -0.0003 -0.0025 -0.0023 -0.0020 -0.0018 -0.0014 -0.0011 -0.0007 -0.0002 0.0002 0.0007 0.0013 0.0018 0.0024 0.0029 0.0035 0.0040 0.0045 -0.0032 -0.0034 -0.0035 -0.0037 -0.0039 -0.0040 -0.0041 -0.0042 -0.0043 -0.0043 -0.0043 -0.0043 -0.0042 -0.0041 -0.0039 -0.0036 -0.0033 0.0006 0.0004 0.0002 0.0000 -0.0002 ...

Matrix dimensions must agree. Error in Test2 (line 28) assert(max(max(abs(m-mexp)))<.01)

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)

m = Columns 1 through 17 -0.0276 -0.1457 -0.1054 0.0490 0.1539 0.1015 -0.0539 -0.1582 -0.1120 0.0393 0.1565 0.1368 -0.0000 -0.1379 -0.1664 -0.0668 0.0829 -0.1457 -0.1028 0.0559 0.1556 0.0893 -0.0720 -0.1614 -0.0896 0.0710 0.1657 0.1074 -0.0484 -0.1634 -0.1407 -0.0024 0.1387 0.1748 -0.1054 0.0559 0.1560 0.0828 -0.0825 -0.1616 -0.0719 0.0930 0.1667 0.0785 -0.0856 -0.1723 -0.1052 0.0541 0.1692 0.1476 0.0102 0.0490 0.1556 0.0828 -0.0858 -0.1610 -0.0606 0.1065 0.1642 0.0543 -0.1114 -0.1707 -0.0689 0.0975 0.1787 0.1062 -0.0555 -0.1738 0.1539 0.0893 -0.0825 -0.1610 -0.0568 0.1129 0.1614 0.0373 -0.1277 -0.1644 -0.0376 0.1274 0.1743 0.0621 -0.1063 -0.1852 -0.1114 0.1015 -0.0720 -0.1616 -0.0606 0.1129 0.1602 0.0287 -0.1365 -0.1579 -0.0142 0.1461 0.1633 0.0228 -0.1409 -0.1783 -0.0590 0.1116 -0.0539 -0.1614 -0.0719 0.1065 0.1614 0.0287 -0.1392 -0.1539 -0.0000 0.1564 0.1517 -0.0077 -0.1617 -0.1621 -0.0110 0.1519 0.1836 -0.1582 -0.0896 0.0930 0.1642 0.0373 -0.1365 -0.1539 0.0048 0.1609 0.1433 -0.0280 -0.1729 -0.1442 0.0274 0.1751 0.1619 0.0030 -0.1120 0.0710 0.1667 0.0543 -0.1277 -0.1579 -0.0000 0.1609 0.1403 -0.0381 -0.1779 -0.1298 0.0544 0.1863 0.1367 -0.0442 -0.1866 0.0393 0.1657 0.0785 -0.1114 -0.1644 -0.0142 0.1564 0.1433 -0.0381 -0.1793 -0.1219 0.0701 0.1906 0.1148 -0.0783 -0.1975 -0.1306 0.1565 0.1074 -0.0856 -0.1707 -0.0376 0.1461 0.1517 -0.0280 -0.1779 -0.1219 0.0752 0.1917 0.1004 -0.0997 -0.1997 -0.1000 0.0991 0.1368 -0.0484 -0.1723 -0.0689 0.1274 0.1633 -0.0077 -0.1729 -0.1298 0.0701 0.1917 0.0954 -0.1100 -0.1988 -0.0774 0.1264 0.2065 -0.0000 -0.1634 -0.1052 0.0975 0.1743 0.0228 -0.1617 -0.1442 0.0544 0.1906 0.1004 -0.1100 -0.1981 -0.0656 0.1414 0.2017 0.0546 -0.1379 -0.1407 0.0541 0.1787 0.0621 -0.1409 -0.1621 0.0274 0.1863 0.1148 -0.0997 -0.1988 -0.0656 0.1461 0.1981 0.0345 -0.1690 -0.1664 -0.0024 0.1692 0.1062 -0.1063 -0.1783 -0.0110 0.1751 0.1367 -0.0783 -0.1997 -0.0774 0.1414 0.1981 0.0276 -0.1775 -0.1929 -0.0668 0.1387 0.1476 -0.0555 -0.1852 -0.0590 0.1519 0.1619 -0.0442 -0.1975 -0.1000 0.1264 0.2017 0.0345 -0.1775 -0.1894 0.0113 0.0829 0.1748 0.0102 -0.1738 -0.1114 0.1116 0.1836 0.0030 -0.1866 -0.1306 0.0991 0.2065 0.0546 -0.1690 -0.1929 0.0113 0.2073 0.1740 0.0828 -0.1357 -0.1581 0.0517 0.1921 0.0607 -0.1603 -0.1640 0.0571 0.2073 0.0869 -0.1497 -0.2019 -0.0038 0.2040 0.1746 0.1462 -0.0677 -0.1839 -0.0246 0.1762 0.1217 -0.1125 -0.1910 -0.0000 0.1965 0.1276 -0.1163 -0.2122 -0.0338 0.1928 0.1844 -0.0494 0.0228 -0.1729 -0.1049 0.1269 0.1718 -0.0413 -0.1992 -0.0686 0.1655 0.1696 -0.0653 -0.2166 -0.0771 0.1697 0.2011 -0.0248 -0.2259 -0.1147 -0.1670 0.0437 0.1922 0.0467 -0.1750 -0.1376 0.1075 0.2009 0.0035 -0.2051 -0.1292 0.1293 0.2184 0.0165 -0.2132 -0.1748 -0.1838 -0.0590 0.1646 0.1325 -0.1100 -0.1881 0.0224 0.2053 0.0837 -0.1667 -0.1798 0.0674 0.2264 0.0726 -0.1861 -0.2013 0.0498 -0.1491 0.0828 0.1867 -0.0089 -0.1965 -0.0774 0.1675 0.1593 -0.0947 -0.2129 -0.0151 0.2117 0.1369 -0.1372 -0.2265 -0.0045 0.2310 -0.0353 0.1784 0.1028 -0.1446 -0.1640 0.0815 0.2045 0.0069 -0.2083 -0.1074 0.1617 0.1953 -0.0616 -0.2368 -0.0753 0.1989 0.2047 0.0952 0.1809 -0.0354 -0.1997 -0.0380 0.1918 0.1166 -0.1497 -0.1858 0.0711 0.2258 0.0369 -0.2151 -0.1525 0.1384 0.2379 -0.0000 0.1794 0.0954 -0.1547 -0.1506 0.1075 0.1948 -0.0381 -0.2166 -0.0485 0.2040 0.1401 -0.1473 -0.2157 0.0453 0.2474 0.0874 -0.2072 0.1836 -0.0325 -0.1997 -0.0286 0.1976 0.0961 -0.1712 -0.1618 0.1163 0.2137 -0.0330 -0.2360 -0.0710 0.2121 0.1770 -0.1304 -0.2533 0.1125 -0.1446 -0.1566 0.1047 0.1936 -0.0484 -0.2164 -0.0226 0.2168 0.1026 -0.1861 -0.1806 0.1186 0.2393 -0.0150 -0.2562 -0.1115 0.0000 -0.1979 -0.0504 0.1918 0.1050 -0.1690 -0.1593 0.1261 0.2063 -0.0616 -0.2362 -0.0226 0.2372 0.1187 -0.1974 -0.2105 0.1088 -0.1100 -0.1783 0.0725 0.2025 -0.0243 -0.2166 -0.0338 0.2156 0.0990 -0.1938 -0.1656 0.1460 0.2241 -0.0696 -0.2607 -0.0331 0.2582 -0.1819 -0.1000 0.1675 0.1406 -0.1418 -0.1798 0.1029 0.2137 -0.0494 -0.2365 -0.0181 0.2411 0.0966 -0.2191 -0.1784 0.1627 0.2501 -0.1985 0.0064 0.2073 0.0345 -0.2083 -0.0806 0.1987 0.1304 -0.1752 -0.1806 0.1346 0.2261 -0.0744 -0.2592 -0.0055 0.2694 0.1016 -0.1622 0.1075 0.1868 -0.0786 -0.2088 0.0415 0.2258 0.0041 -0.2345 -0.0581 0.2310 0.1187 -0.2103 -0.1823 0.1673 0.2422 -0.0977 -0.0889 0.1784 0.1194 -0.1667 -0.1516 0.1476 0.1844 -0.1195 -0.2157 0.0807 0.2427 -0.0300 -0.2612 -0.0331 0.2653 0.1072 -0.2478 -0.0000 0.2073 0.0276 -0.2118 -0.0594 0.2117 0.0953 -0.2052 -0.1349 0.1902 0.1770 -0.1641 -0.2196 0.1241 0.2591 -0.0677 -0.2898 0.0845 0.1948 -0.0653 -0.2106 0.0415 0.2251 -0.0124 -0.2368 -0.0226 0.2441 0.0639 -0.2447 -0.1115 0.2356 0.1647 -0.2129 -0.2212 0.1507 0.1503 -0.1418 -0.1712 0.1293 0.1932 -0.1121 -0.2157 0.0894 0.2379 -0.0598 -0.2585 0.0222 0.2753 0.0246 -0.2854 -0.0814 0.1918 0.0869 -0.1924 -0.1074 0.1907 0.1304 -0.1861 -0.1558 0.1777 0.1837 -0.1641 -0.2136 0.1439 0.2449 -0.1152 -0.2763 0.0758 0.2075 0.0173 -0.2149 -0.0338 0.2216 0.0530 -0.2272 -0.0753 0.2310 0.1011 -0.2321 -0.1308 0.2295 0.1647 -0.2214 -0.2028 0.2058 0.2017 -0.0484 -0.2129 0.0378 0.2246 -0.0248 -0.2365 0.0091 0.2484 0.0100 -0.2600 -0.0331 0.2706 0.0609 -0.2792 -0.0944 0.2846 0.1805 -0.1041 -0.1929 0.0994 0.2063 -0.0932 -0.2208 0.0850 0.2365 -0.0744 -0.2533 0.0608 0.2712 -0.0432 -0.2898 0.0208 0.3087 0.1503 -0.1471 -0.1618 0.1476 0.1746 -0.1473 -0.1889 0.1460 0.2047 -0.1434 -0.2224 0.1390 0.2422 -0.1323 -0.2641 0.1224 0.2885 0.1166 -0.1775 -0.1262 0.1819 0.1369 -0.1861 -0.1491 0.1902 0.1628 -0.1939 -0.1784 0.1971 0.1963 -0.1994 -0.2168 0.2005 0.2403 0.0837 -0.1971 -0.0909 0.2040 0.0990 -0.2113 -0.1082 0.2191 0.1187 -0.2272 -0.1308 0.2356 0.1448 -0.2444 -0.1610 0.2533 0.1801 0.0546 -0.2083 -0.0594 0.2168 0.0648 -0.2259 -0.0710 0.2358 0.0781 -0.2465 -0.0863 0.2582 0.0959 -0.2708 -0.1071 0.2846 0.1204 0.0310 -0.2138 -0.0338 0.2231 0.0369 -0.2331 -0.0405 0.2441 0.0446 -0.2562 -0.0493 0.2694 0.0549 -0.2841 -0.0615 0.3004 0.0693 0.0139 -0.2160 -0.0151 0.2256 0.0165 -0.2360 -0.0181 0.2474 0.0199 -0.2600 -0.0221 0.2739 0.0246 -0.2894 -0.0276 0.3067 0.0311 0.0035 -0.2166 -0.0038 0.2263 0.0041 -0.2368 -0.0045 0.2483 0.0050 -0.2610 -0.0055 0.2751 0.0062 -0.2908 -0.0069 0.3084 0.0078 -0.0000 -0.2167 0.0000 0.2264 -0.0000 -0.2369 -0.0000 0.2484 -0.0000 -0.2612 0.0000 0.2753 -0.0000 -0.2910 -0.0000 0.3087 -0.0000 0.0035 -0.2166 -0.0038 0.2263 0.0041 -0.2368 -0.0045 0.2483 0.0050 -0.2610 -0.0055 0.2751 0.0062 -0.2908 -0.0069 0.3084 0.0078 0.0139 -0.2160 -0.0151 0.2256 0.0165 -0.2360 -0.0181 0.2474 0.0199 -0.2600 -0.0221 0.2739 0.0246 -0.2894 -0.0276 0.3067 0.0311 0.0310 -0.2138 -0.0338 0.2231 0.0369 -0.2331 -0.0405 0.2441 0.0446 -0.2562 -0.0493 0.2694 0.0549 -0.2841 -0.0615 0.3004 0.0693 0.0546 -0.2083 -0.0594 0.2168 0.0648 -0.2259 -0.0710 0.2358 0.0781 -0.2465 -0.0863 0.2582 0.0959 -0.2708 -0.1071 0.2846 0.1204 0.0837 -0.1971 -0.0909 0.2040 0.0990 -0.2113 -0.1082 0.2191 0.1187 -0.2272 -0.1308 0.2356 0.1448 -0.2444 -0.1610 0.2533 0.1801 0.1166 -0.1775 -0.1262 0.1819 0.1369 -0.1861 -0.1491 0.1902 0.1628 -0.1939 -0.1784 0.1971 0.1963 -0.1994 -0.2168 0.2005 0.2403 0.1503 -0.1471 -0.1618 0.1476 0.1746 -0.1473 -0.1889 0.1460 0.2047 -0.1434 -0.2224 0.1390 0.2422 -0.1323 -0.2641 0.1224 0.2885 0.1805 -0.1041 -0.1929 0.0994 0.2063 -0.0932 -0.2208 0.0850 0.2365 -0.0744 -0.2533 0.0608 0.2712 -0.0432 -0.2898 0.0208 0.3087 0.2017 -0.0484 -0.2129 0.0378 0.2246 -0.0248 -0.2365 0.0091 0.2484 0.0100 -0.2600 -0.0331 0.2706 0.0609 -0.2792 -0.0944 0.2846 0.2075 0.0173 -0.2149 -0.0338 0.2216 ...

Matrix dimensions must agree. Error in Test3 (line 28) assert(max(max(abs(m-mexp)))<.01)