Cody

# Problem 2460. Signal Processing Basic - 1. Stretch a signal

Solution 1625503

Submitted on 11 Sep 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
n = 1:10; a = sin(2*pi*(50/500)*n); b = [0.5878 0.9458 0.9511 0.7323 0.2484 -0.3112 -0.7803 -0.9511 -0.9276 -0.5413]; assert(sqrt(sum((b - stc(a,.9)).^2))<.1)

Error using griddedInterpolant Interpolation requires at least two sample points in each dimension. Error in interp2>makegriddedinterp (line 228) F = griddedInterpolant(varargin{:}); Error in interp2 (line 100) F = makegriddedinterp({X,Y},V,method,extrap); Error in stc (line 2) y = interp2(x,(1:numel(x))*factor); Error in Test1 (line 4) assert(sqrt(sum((b - stc(a,.9)).^2))<.1)

2   Fail
a = [1 2 1 3 1 4 5]; b = [1.0000 1.9900 1.1040 2.5680 1.7040 2.3125 4.5680]; assert(sqrt(sum((b - stc(a,.9)).^2))<.1);

Error using griddedInterpolant Interpolation requires at least two sample points in each dimension. Error in interp2>makegriddedinterp (line 228) F = griddedInterpolant(varargin{:}); Error in interp2 (line 100) F = makegriddedinterp({X,Y},V,method,extrap); Error in stc (line 2) y = interp2(x,(1:numel(x))*factor); Error in Test2 (line 3) assert(sqrt(sum((b - stc(a,.9)).^2))<.1);

3   Fail
n = 1:10000; a = sin(2*pi*(50/500)*n); b = a; assert(sqrt(sum((b - stc(a,1)).^2))<.1);

Error using griddedInterpolant Interpolation requires at least two sample points in each dimension. Error in interp2>makegriddedinterp (line 228) F = griddedInterpolant(varargin{:}); Error in interp2 (line 100) F = makegriddedinterp({X,Y},V,method,extrap); Error in stc (line 2) y = interp2(x,(1:numel(x))*factor); Error in Test3 (line 4) assert(sqrt(sum((b - stc(a,1)).^2))<.1);