simple array calculation help

2 vues (au cours des 30 derniers jours)
Mahesh Sadupalli
Mahesh Sadupalli le 23 Avr 2021
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).

Réponses (1)

Cris LaPierre
Cris LaPierre le 23 Avr 2021
I suggest going through MATLAB Onramp

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by