for loop index picking only elements of given vector

조회 수: 4(최근 30일)
Hi all,
I am trying to see the loop index j only picking the element of given vector V.
for example for index j can pick value 1, 4, 8, 11 and so on.
Expecting your help.
Thanks
Dharma
syms x t
c(1)=10*dirac(x-1);
V=[1 4 8 11 15 18 22];
for j= .....%it needs to pick only elements of above vector V
c(x)=c(x)+dirac(x-j);
end

채택된 답변

Voss
Voss 2022년 8월 7일
for j = V
  댓글 수: 2
Voss
Voss 2022년 8월 17일
for j=vec(2:end)

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by