Cody

Problem 43279. Weighted moving average

Solution 2131301

Submitted on 17 Feb 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   Fail
x1=[1 2 1]; y1=[1 2 2 4 5 6 6 8]; y_correct = [2.3333 3.3333 5.0000 6.6667 7.6667 8.6667]; assert(sum(abs(smooth1dconv(x1,y1)-y_correct))<0.001)

Array indices must be positive integers or logical values. Error in smooth1dconv (line 3) z(i)=x1'*y1(1+i:3+i) Error in Test1 (line 3) assert(sum(abs(smooth1dconv(x1,y1)-y_correct))<0.001)

2   Fail
x1=[1 2 1]; y1=[1 1 1 1 1 1 1 1]; y_correct = [1.3333 1.3333 1.3333 1.3333 1.3333 1.3333]; assert(sum(abs(smooth1dconv(x1,y1)-y_correct))<0.001)

Array indices must be positive integers or logical values. Error in smooth1dconv (line 3) z(i)=x1'*y1(1+i:3+i) Error in Test2 (line 3) assert(sum(abs(smooth1dconv(x1,y1)-y_correct))<0.001)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!