Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Correct

24Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%% Test the example
A = 1;
iterations = 4;
y_correct8 = [1     3     7    15    31];
assert(isequal(your_fcn_name(A,iterations),y_correct8))
ans =
     1     3     7    15    31
2
Pass
 
%% More ietrations
A = 1;
iterations = 1000;
C= A
for i = 1:iterations
  C(i+1) = 2*C(i)+1;
end
assert(isequal(your_fcn_name(A,iterations),C))
C =
     1
ans =
  1.0e+301 *
  Columns 1 through 3
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 4 through 6
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 7 through 9
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 10 through 12
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 13 through 15
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 16 through 18
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 19 through 21
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 22 through 24
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 25 through 27
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 28 through 30
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 31 through 33
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 34 through 36
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 37 through 39
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 40 through 42
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 43 through 45
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 46 through 48
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 49 through 51
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 52 through 54
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 55 through 57
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 58 through 60
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 61 through 63
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 64 through 66
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 67 through 69
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 70 through 72
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 73 through 75
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 76 through 78
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 79 through 81
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 82 through 84
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 85 through 87
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 88 through 90
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 91 through 93
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 94 through 96
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 97 through 99
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 100 through 102
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 103 through 105
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 106 through 108
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 109 through 111
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 112 through 114
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 115 through 117
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 118 through 120
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 121 through 123
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 124 through 126
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 127 through 129
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 130 through 132
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 133 through 135
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 136 through 138
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 139 through 141
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 142 through 144
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 145 through 147
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 148 through 150
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 151 through 153
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 154 through 156
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 157 through 159
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 160 through 162
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 163 through 165
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 166 through 168
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 169 through 171
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 172 through 174
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 175 through 177
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 178 through 180
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 181 through 183
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 184 through 186
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 187 through 189
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 190 through 192
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 193 through 195
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 196 through 198
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 199 through 201
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 202 through 204
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 205 through 207
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 208 through 210
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 211 through 213
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 214 through 216
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 217 through 219
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 220 through 222
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 223 through 225
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 226 through 228
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 229 through 231
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 232 through 234
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 235 through 237
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 238 through 240
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 241 through 243
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 244 through 246
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 247 through 249
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 250 through 252
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 253 through 255
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 256 through 258
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 259 through 261
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 262 through 264
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 265 through 267
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 268 through 270
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 271 through 273
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 274 through 276
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 277 through 279
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 280 through 282
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 283 through 285
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 286 through 288
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 289 through 291
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 292 through 294
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 295 through 297
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 298 through 300
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 301 through 303
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 304 through 306
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 307 through 309
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 310 through 312
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 313 through 315
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 316 through 318
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 319 through 321
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 322 through 324
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 325 through 327
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 328 through 330
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 331 through 333
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 334 through 336
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 337 through 339
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 340 through 342
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 343 through 345
   0.000000000000000   0.000000000000000   0.000000000000000
  Columns 346 through 348
   0.00000...