MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply TodayThis Challenge is to efficiently create the Sombrero function of various sizes, resolutions, and frequencies.

**Figure Example:** Freq=1; XY_max_value=3; Num Rows / Cols 64

Create the 2-D array m(row,col)=sin(pi*R*freq)/(pi*R*freq) where R is the distance from the center of the array. The array is [nrc,nrc] with X(1,1)=Y(1,1)= - xymax and X(nrc,nrc)=Y(nrc,nrc)=xymax.

**Input:** [xymax,nrc,freq]

**Output:** [m] an array of size(nrc,nrc) representing the sin(x)/x function

**Hints:**

Matlab provides excellent functions and array operators to readily create vectors and grids. [ linspace, meshgrid ]

**Future:**

Polar grid creation to produce Zernike surfaces

23 correct solutions
37 incorrect solutions

Last solution submitted on Jan 14, 2016

2 Comments

Richard Zapor
on 1 Mar 2013

Khaled solves the Zero divide dilemna.

Khaled Hamed
on 2 Mar 2013

Isn't this a known trick?

2 Comments

Tim
on 28 Feb 2013

Solutions with no fixup for sin(0)/0 cheat a little (since NaNs are ignored in max(...)<0.01)--this solution cheats a lot.

Alfonso Nieto-Castanon
on 1 Mar 2013

ha, good catch!

1 player likes this solution

1 Comment

Richard Zapor
on 28 Feb 2013

Vitaly makes beautiful usage of complex to find the radial distance.

2 Comments