Cody

Solution 2159548

Submitted on 14 Mar 2020
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   Pass
y = [0 1 2 3 4 3 2 1 0]; F = 4; assert(abs((fwhm(y)-F)/F)<0.1)

c = 5 d = 3 7

2   Pass
y = [0, 1:10, 9:-1:1, 0]; F = 10; assert(abs((fwhm(y)-F)/F)<0.1)

c = 11 d = 6 16

3   Pass
y = [0 1 1 1 1 0]'; F = 4; assert(abs((fwhm(y)-F)/F)<0.1)

c = 2 3 4 5 d = 0×1 empty double column vector

4   Pass
y = [zeros(1,3),ones(1,10),zeros(1,5)]; F = 10; assert(abs((fwhm(y)-F)/F)<0.1)

c = 4 5 6 7 8 9 10 11 12 13 d = 1×0 empty double row vector

5   Fail
for i = 1:200 maxX = randi(10) + 10; F = rand*4+1; x = -maxX:maxX; y = exp(-4*log(2)*x.^2/F^2); assert(abs((fwhm(y)-F)/F)<0.1) end

c = 18 d = 1×0 empty double row vector

Assertion failed.

6   Pass
user_solution = fileread('fwhm.m'); assert(isempty(strfind(user_solution,'regexp'))); assert(isempty(strfind(user_solution,'num2str'))); assert(isempty(strfind(user_solution,'fprintf'))); assert(isempty(strfind(user_solution,'assert')));