What you get with: (0:n-1)*n + 1:n
Afficher commentaires plus anciens
What you get with:
n = 4;
(0:n-1)*n + 1:n % 1 2 3 4
I was expecting:
(0:n-1)*n + (1:n) % 1 6 11 16
Réponse acceptée
Plus de réponses (3)
Sean de Wolski
le 12 Avr 2011
And the transpose acts as expected:
>> ((0:n-1)*n)'
ans =
0
4
8
12
>> ans+(1:n)'
ans =
1
6
11
16
1 commentaire
Oleg Komarov
le 12 Avr 2011
Sean de Wolski
le 12 Avr 2011
I'm able to replicate this. Mac OSX R2009b.
It also fails if I break it between lines:
>> ((0:n-1)*n)
ans =
0 4 8 12
>> ans+1:n
ans =
1 2 3 4
VIGNESH
le 30 Avr 2023
0 votes
u = 0:1/n:1
Catégories
En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!