simple array calculation help
2 views (last 30 days)
Show older comments
Write a program that will smooth an array of data using an exponential moving average. For the input data we assume a row vector with 𝑁 elements. We use the following expression for the average: Xavg,𝑘 = 𝛼X(𝑎v,𝑘−1) + (1 − 𝛼) ⋅ X𝑘, except for 𝑘 = 1, where X𝑎vg,1 = X1. You can use the following statement (for MATLAB) to create a row vector of data with noise from a normal distribution with a mean of 5.0 and a standard deviation of 3.0 to test your program:
1) inputData = 5.0 + 3.0 ∗ 𝑟andn(1,100);
2) 𝛼= 0.8
Please use only basic operators like assignment, comparison, conditional statement, and loops. Do not use built in functions or advanced possibilities of a specific programming language (e.g. vectorization in MATLAB).
0 Comments
Answers (1)
See Also
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!