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

3 ビュー (過去 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 Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by