simple array calculation help
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!