Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 308917

Submitted on 22 Aug 2013 by Cui Xiaopeng

Correct

10Size
Leading solution size is 9.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
cVec = 5:-.2:-5;
ref = (1/sqrt(2*pi*2.5^2))*exp((-1*cVec.^2)/(2*2.5^2));
user = MyFunc();
assert(isequal(user,ref))
xVec =
  Columns 1 through 9
    0.0216    0.0253    0.0294    0.0339    0.0389    0.0444    0.0503    0.0566    0.0633
  Columns 10 through 18
    0.0703    0.0777    0.0852    0.0929    0.1007    0.1083    0.1159    0.1231    0.1300
  Columns 19 through 27
    0.1364    0.1422    0.1473    0.1516    0.1550    0.1575    0.1591    0.1596    0.1591
  Columns 28 through 36
    0.1575    0.1550    0.1516    0.1473    0.1422    0.1364    0.1300    0.1231    0.1159
  Columns 37 through 45
    0.1083    0.1007    0.0929    0.0852    0.0777    0.0703    0.0633    0.0566    0.0503
  Columns 46 through 51
    0.0444    0.0389    0.0339    0.0294    0.0253    0.0216
ans =
     []
2
Pass
 
%%
[xVec cVec] = MyFunc();
cRef = 5:-.2:-5;
assert(isequal(cRef,cVec))
xVec =
  Columns 1 through 9
    0.0216    0.0253    0.0294    0.0339    0.0389    0.0444    0.0503    0.0566    0.0633
  Columns 10 through 18
    0.0703    0.0777    0.0852    0.0929    0.1007    0.1083    0.1159    0.1231    0.1300
  Columns 19 through 27
    0.1364    0.1422    0.1473    0.1516    0.1550    0.1575    0.1591    0.1596    0.1591
  Columns 28 through 36
    0.1575    0.1550    0.1516    0.1473    0.1422    0.1364    0.1300    0.1231    0.1159
  Columns 37 through 45
    0.1083    0.1007    0.0929    0.0852    0.0777    0.0703    0.0633    0.0566    0.0503
  Columns 46 through 51
    0.0444    0.0389    0.0339    0.0294    0.0253    0.0216
ans =
     []