summation inside for loop

조회 수: 1 (최근 30일)
Mert Demir
Mert Demir 2021년 7월 21일
편집: Mert Demir 2022년 2월 23일
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.

답변 (1개)

Torsten
Torsten 2021년 7월 21일
vec = ones(1,5)*Q_z.' ;
exp2(1:100,:) = vec ;
  댓글 수: 1
Mert Demir
Mert Demir 2021년 7월 21일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by