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

5 vues (au cours des 30 derniers jours)
STamer
STamer le 6 Mar 2013
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 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 6 Mar 2013
You did not explain the relation between N and the result

Connectez-vous pour commenter.

Réponse acceptée

Jan
Jan le 6 Mar 2013
Modifié(e) : Jan le 6 Mar 2013
Another guess:
V = ones(1, N);
V(3:3:end) = 0;

Plus de réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 6 Mar 2013
Modifié(e) : Azzi Abdelmalek le 6 Mar 2013
V=[1 1 0 1 1 0 1 1 0 1 1 0]
N=3
V(N:N:end)=0

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by