0% found this document useful (0 votes)
32 views

Homework 2: 'X1/tx2/ty1/ty2/n'

The document defines two vectors x1 and x2 of length 10 and 19 respectively. It then uses a for loop to call the function HW2_4 for each combination of indices in x1 and x2, printing the output values y1 and y2. This results in a table with x1, x2, y1 and y2 values.

Uploaded by

Kevin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Homework 2: 'X1/tx2/ty1/ty2/n'

The document defines two vectors x1 and x2 of length 10 and 19 respectively. It then uses a for loop to call the function HW2_4 for each combination of indices in x1 and x2, printing the output values y1 and y2. This results in a table with x1, x2, y1 and y2 values.

Uploaded by

Kevin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Homework 2

x1 = [1:1:10];
x2 = [1:1:19];
l1 = length(x1);
l2 = length(x2);
fprintf('x1\tx2\ty1\ty2\n')

x1 x2 y1 y2

fprintf('----------------------------\n')

----------------------------

for c1 = 1:1:l1
for c2 = 1:1:l2
a = HW2_4(c1,c2);
y1 = a(1,1);
y2 = a(1,2);
fprintf('%i\t %i\t %i\t %i\n',c1,c2,y1,y2)
end
end

1 1 2 2
1 2 3 5
1 3 4 10
1 4 5 17
1 5 6 26
1 6 7 37
1 7 8 50
1 8 9 65
1 9 10 82
1 10 11 101
1 11 12 122
1 12 13 145
1 13 14 170
1 14 15 197
1 15 16 226
1 16 17 257
1 17 18 290
1 18 19 325
1 19 20 362
2 1 5 3
2 2 6 6
2 3 7 11
2 4 8 18
2 5 9 27
2 6 10 38
2 7 11 51
2 8 12 66
2 9 13 83
2 10 14 102
2 11 15 123
2 12 16 146
2 13 17 171
2 14 18 198
2 15 19 227
2 16 20 258
2 17 21 291
2 18 22 326
2 19 23 363
3 1 10 4
3 2 11 7
3 3 12 12
3 4 13 19
3 5 14 28
3 6 15 39
3 7 16 52
3 8 17 67
3 9 18 84
3 10 19 103
3 11 20 124
3 12 21 147
3 13 22 172
3 14 23 199
3 15 24 228
3 16 25 259
3 17 26 292
3 18 27 327
3 19 28 364
4 1 17 5
4 2 18 8
4 3 19 13
4 4 20 20
4 5 21 29
4 6 22 40
4 7 23 53
4 8 24 68
4 9 25 85
4 10 26 104
4 11 27 125
4 12 28 148
4 13 29 173
4 14 30 200
4 15 31 229
4 16 32 260
4 17 33 293
4 18 34 328
4 19 35 365
5 1 26 6
5 2 27 9
5 3 28 14
5 4 29 21
5 5 30 30
5 6 31 41
5 7 32 54
5 8 33 69
5 9 34 86
5 10 35 105
5 11 36 126
5 12 37 149
5 13 38 174
5 14 39 201
5 15 40 230
5 16 41 261
5 17 42 294
5 18 43 329
5 19 44 366
6 1 37 7
6 2 38 10
6 3 39 15
6 4 40 22
6 5 41 31
6 6 42 42
6 7 43 55
6 8 44 70
6 9 45 87
6 10 46 106
6 11 47 127
6 12 48 150
6 13 49 175
6 14 50 202
6 15 51 231
6 16 52 262
6 17 53 295
6 18 54 330
6 19 55 367
7 1 50 8
7 2 51 11
7 3 52 16
7 4 53 23
7 5 54 32
7 6 55 43
7 7 56 56
7 8 57 71
7 9 58 88
7 10 59 107
7 11 60 128
7 12 61 151
7 13 62 176
7 14 63 203
7 15 64 232
7 16 65 263
7 17 66 296
7 18 67 331
7 19 68 368
8 1 65 9
8 2 66 12
8 3 67 17
8 4 68 24
8 5 69 33
8 6 70 44
8 7 71 57
8 8 72 72
8 9 73 89
8 10 74 108
8 11 75 129
8 12 76 152
8 13 77 177
8 14 78 204
8 15 79 233
8 16 80 264
8 17 81 297
8 18 82 332
8 19 83 369
9 1 82 10
9 2 83 13
9 3 84 18
9 4 85 25
9 5 86 34
9 6 87 45
9 7 88 58
9 8 89 73
9 9 90 90
9 10 91 109
9 11 92 130
9 12 93 153
9 13 94 178
9 14 95 205
9 15 96 234
9 16 97 265
9 17 98 298
9 18 99 333
9 19 100 370
10 1 101 11
10 2 102 14
10 3 103 19
10 4 104 26
10 5 105 35
10 6 106 46
10 7 107 59
10 8 108 74
10 9 109 91
10 10 110 110
10 11 111 131
10 12 112 154
10 13 113 179
10 14 114 206
10 15 115 235
10 16 116 266
10 17 117 299
10 18 118 334
10 19 119 371

You might also like