Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
pmin = 20;
pmax = 30;
d = [1 2 3 4 5];
n = [10 9 4 7 2];
p = fit_distribution(d,n,pmin,pmax)
assert(~any(p<pmin) && ~any(p>pmax))
for i = 1:length(d)
assert(isequal(n(i), sum(rem(p,d(i))==0)))
end
10 9 4 7 2
p =
20 20 21 22 22 24 24 24 28 28
|
2 | Pass |
pmin = 1;
pmax = 50;
d = [1 3 5 7 8 9];
n = [40 14 12 6 4 1];
p = fit_distribution(d,n,pmin,pmax);
assert(~any(p<pmin) && ~any(p>pmax))
for i = 1:length(d)
assert(isequal(n(i), sum(rem(p,d(i))==0)))
end
40 14 12 6 4 1
|
3 | Pass |
pmin = 100;
pmax = 200;
d = [1 8 9 15 22];
n = [20 2 1 0 2];
p = fit_distribution(d,n,pmin,pmax);
assert(~any(p<pmin) && ~any(p>pmax))
for i = 1:length(d)
assert(isequal(n(i), sum(rem(p,d(i))==0)))
end
20 2 1 0 2
|
4 | Pass |
pmin = 5;
pmax = 37;
d = [1 10 20 3 11];
n = [60 7 1 19 5];
p = fit_distribution(d,n,pmin,pmax);
assert(~any(p<pmin) && ~any(p>pmax))
for i = 1:length(d)
assert(isequal(n(i), sum(rem(p,d(i))==0)))
end
60 7 1 19 5
|
Least common multiple of many numbers
189 Solvers
192 Solvers
123 Solvers
Piecewise linear interpolation
298 Solvers
669 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!