Mostrar comentarios más antiguos
Respuestas (3)
Walter Roberson
el 26 de Mzo. de 2012
0 votos
This is not possible in MATLAB, as MATLAB arrays cannot be indexed at negative numbers or 0, but you want to index y at -3, -2, -1, and 0, along with 1, 2, and 3.
1 comentario
fadi rami
el 26 de Mzo. de 2012
Geoff
el 26 de Mzo. de 2012
I think you mean this:
x = -3:3;
y = 2 * x + 3;
plot(x, y);
3 comentarios
fadi rami
el 26 de Mzo. de 2012
Geoff
el 26 de Mzo. de 2012
So you mean:
x = 1:7;
y = -3:3;
Here, y is "the value when x=1 is -3... etc", and you access it like this: y(1)
Geoff
el 26 de Mzo. de 2012
Alternatively, if you really did mean n = -3:3 and y = 2n + 3, then:
x = 1:7;
n = -3:3;
y = 2*n + 3;
Image Analyst
el 26 de Mzo. de 2012
0 votos
Don't forget to check your duplicate post in the newsgroup: http://groups.google.com/group/comp.soft-sys.matlab/browse_frm/thread/23153174886ed6bd?hl=en#
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!