summation inside for loop

Have a good day. I am trying to find an easy way of writing a loop below:
v=rand(100,3)
for iz=1:3
for iznext=1 expv(:,iz)=v(:,iz)*Q_z(iz,iznext)+v(:,iz)*Q_z(iz,iznext+1)+v(:,iz)*Q_z(iz,iznext+2);
end
end
Thanks in advance.

Réponses (1)

Torsten
Torsten le 21 Juil 2021

0 votes

vec = ones(1,5)*Q_z.' ;
exp2(1:100,:) = vec ;

1 commentaire

Mert Demir
Mert Demir le 21 Juil 2021
Thanks but i need to use v_e in the form. v_e will not be ones(100,5) later on. it is just an initial guess. I will keep iterate that.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Produits

Question posée :

le 21 Juil 2021

Modifié(e) :

le 23 Fév 2022

Community Treasure Hunt

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

Start Hunting!

Translated by