Buildind special vector? V(3)=V(6)=V(9)...=0

조회 수: 1 (최근 30일)
STamer
STamer 2013년 3월 6일
How can I build
V=[1 1 0 1 1 0 1 1 0 1 1 0....]vector.I want to put N value and it will reply me V vector..
Elements fo V will be V(3)=V(6)=V(9)...=0
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 6일
You did not explain the relation between N and the result

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

채택된 답변

Jan
Jan 2013년 3월 6일
편집: Jan 2013년 3월 6일
Another guess:
V = ones(1, N);
V(3:3:end) = 0;

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 6일
편집: Azzi Abdelmalek 2013년 3월 6일
V=[1 1 0 1 1 0 1 1 0 1 1 0]
N=3
V(N:N:end)=0

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by