# Obtaining result from a previous point

1 vue (au cours des 30 derniers jours)
Tino le 10 Jan 2020
Commenté : Tino le 31 Jan 2020
Hello please can anyone help me to calculate the following
I have a result which give M which give a row of numbers
I want to calculate the formular
H{j} = (1 - 0.5) * H{j-1} + (0.5 * M)
assuming the first H{0} = 0
j = 0,1,2,3,4,5,6 and M = 0.3 ,0.2, 0.4, 0.5, 0.6, 0.8
how do i write the code
Your help will be greatly appreciated
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

M le 10 Jan 2020
Modifié(e) : M le 10 Jan 2020
Have a look here:
You can write something like:
n= 7;
H = zeros(n,1);
for j = 2 : n
H(j) = 0.5*H(j-1) + 0.5*M(j)
end
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Tino le 31 Jan 2020
Thank you

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by