>> X = [1;2;3;4;5;6];
>> Y = bsxfun(@plus,X,0:10:40);
>> Z = bsxfun(@plus,Y(:),0:20);
>> Z
Z =
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
Best Answer