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

3 visualizaciones (últimos 30 días)
STamer
STamer el 6 de Mzo. de 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 comentario
Azzi Abdelmalek
Azzi Abdelmalek el 6 de Mzo. de 2013
You did not explain the relation between N and the result

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 6 de Mzo. de 2013
Editada: Jan el 6 de Mzo. de 2013
Another guess:
V = ones(1, N);
V(3:3:end) = 0;

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 6 de Mzo. de 2013
Editada: Azzi Abdelmalek el 6 de Mzo. de 2013
V=[1 1 0 1 1 0 1 1 0 1 1 0]
N=3
V(N:N:end)=0

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by