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

11Size
This is the leading solution.
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))
z =
     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
z =
  1.0e+301 *
  Columns 1 through 6
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 7 through 12
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 13 through 18
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 19 through 24
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 25 through 30
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 31 through 36
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 37 through 42
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 43 through 48
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 49 through 54
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 55 through 60
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 61 through 66
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 67 through 72
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 73 through 78
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 79 through 84
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 85 through 90
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 91 through 96
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 97 through 102
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 103 through 108
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 109 through 114
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 115 through 120
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 121 through 126
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 127 through 132
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 133 through 138
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 139 through 144
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 145 through 150
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 151 through 156
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 157 through 162
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 163 through 168
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 169 through 174
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 175 through 180
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 181 through 186
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 187 through 192
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 193 through 198
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 199 through 204
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 205 through 210
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 211 through 216
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 217 through 222
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 223 through 228
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 229 through 234
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 235 through 240
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 241 through 246
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 247 through 252
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 253 through 258
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 259 through 264
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 265 through 270
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 271 through 276
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 277 through 282
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 283 through 288
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 289 through 294
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 295 through 300
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 301 through 306
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 307 through 312
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 313 through 318
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 319 through 324
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 325 through 330
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 331 through 336
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 337 through 342
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 343 through 348
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 349 through 354
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 355 through 360
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 361 through 366
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 367 through 372
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 373 through 378
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 379 through 384
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 385 through 390
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 391 through 396
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 397 through 402
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 403 through 408
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 409 through 414
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 415 through 420
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 421 through 426
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 427 through 432
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 433 through 438
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 439 through 444
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 445 through 450
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 451 through 456
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 457 through 462
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 463 through 468
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 469 through 474
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 475 through 480
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 481 through 486
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 487 through 492
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 493 through 498
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 499 through 504
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 505 through 510
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 511 through 516
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 517 through 522
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 523 through 528
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 529 through 534
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 535 through 540
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 541 through 546
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 547 through 552
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 553 through 558
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 559 through 564
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 565 through 570
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 571 through 576
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 577 through 582
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 583 through 588
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 589 through 594
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 595 through 600
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 601 through 606
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 607 through 612
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 613 through 618
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 619 through 624
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 625 through 630
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 631 through 636
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 637 through 642
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 643 through 648
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 649 through 654
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 655 through 660
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 661 through 666
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 667 through 672
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 673 through 678
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 679 through 684
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Columns 685 through 690
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  ...