Weighted moving average - MATLAB Cody - MATLAB Central

Problem 43279. Weighted moving average

Difficulty:Rate

x1=[1 2 1]; y1=[1 2 2 4 5 6 6 8];

Make function for weighted moving average.

z(i)=(x1(i)*y1(i)+x1(i+1)*y1(i+1)+x1(i+2)*y1(i+2))/3

As a result,

z =
    2.3333    3.3333    5.0000    6.6667    7.6667    8.6667

Solution Stats

44.44% Correct | 55.56% Incorrect
Last Solution submitted on Apr 15, 2025

Problem Comments

Solution Comments

Show comments
Registration Now Open for MathWorks AUTOMOTIVE CONFERENCE 2025
...
Hello Community, We're excited to announce that registration is now open for the...

Problem Recent Solvers48

Suggested Problems

More from this Author27

Community Treasure Hunt

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

Start Hunting!
Go to top of page