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

Solution 192310

Submitted on 17 Jan 2013 by Aurelien Queffurust

Correct

71Size
Leading solution size is 10.
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
 
%%
x = [0 1;1 1];
tf = true;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
     0     1
     1     1
tf =
     1
2
Pass
 
%%
x = [1 0;1 1];
tf = false;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
     1     0
     1     1
3
Pass
 
%%
x = [0 1;1 1]^40;
tf = true;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
    63245986   102334155
   102334155   165580141
tf =
     1
4
Pass
 
%%
x = [0 1;1 1]^40+1;
tf = false;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
    63245987   102334156
   102334156   165580142
5
Pass
 
%%
x = [0 1;1 1]^17;
tf = true;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
         987        1597
        1597        2584
tf =
     1
6
Pass
 
%%
x = [0 1;1 1]^17-5;
tf = false;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
         982        1592
        1592        2579
7
Pass
 
%%
x = [0 0 1;0 1 1;1 1 1]^3;
tf = false;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
     1     2     3
     2     4     5
     3     5     6
8
Pass
 
%%
x = [0 0 1;0 1 1];
tf = false;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
     0     0     1
     0     1     1
9
Pass
 
%%
x = [[0 1;1 1]^3 [5; 8]];
tf = false;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
     1     2     5
     2     3     8
10
Pass
 
%%
x = uint8([0 1; 1 1]^5);
tf = true;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
     3     5
     5     8
tf =
     1
11
Pass
 
%%
x = -([0 1; 1 1]^5);
tf = false;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
    -3    -5
    -5    -8
12
Pass
 
%%
x = [0 1; 1 1]^5;
x(2) = nan;
tf = false;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
     3     5
   NaN     8
13
Pass
 
%%
x = [4 7;7 11];
tf = false;
assert(isequal(isFibMat(x),tf))
clear all;
tf =
     0
phi =
    1.6180
x =
     4     7
     7    11
14
Pass
 
%%
for ii = 1:55
    assert(true==isFibMat([0 1;1 1]^ii))
end
tf =
     0
phi =
    1.6180
x =
     0     1
     1     1
tf =
     1
tf =
     0
phi =
    1.6180
x =
     1     1
     1     2
tf =
     1
tf =
     0
phi =
    1.6180
x =
     1     2
     2     3
tf =
     1
tf =
     0
phi =
    1.6180
x =
     2     3
     3     5
tf =
     1
tf =
     0
phi =
    1.6180
x =
     3     5
     5     8
tf =
     1
tf =
     0
phi =
    1.6180
x =
     5     8
     8    13
tf =
     1
tf =
     0
phi =
    1.6180
x =
     8    13
    13    21
tf =
     1
tf =
     0
phi =
    1.6180
x =
    13    21
    21    34
tf =
     1
tf =
     0
phi =
    1.6180
x =
    21    34
    34    55
tf =
     1
tf =
     0
phi =
    1.6180
x =
    34    55
    55    89
tf =
     1
tf =
     0
phi =
    1.6180
x =
    55    89
    89   144
tf =
     1
tf =
     0
phi =
    1.6180
x =
    89   144
   144   233
tf =
     1
tf =
     0
phi =
    1.6180
x =
   144   233
   233   377
tf =
     1
tf =
     0
phi =
    1.6180
x =
   233   377
   377   610
tf =
     1
tf =
     0
phi =
    1.6180
x =
   377   610
   610   987
tf =
     1
tf =
     0
phi =
    1.6180
x =
         610         987
         987        1597
tf =
     1
tf =
     0
phi =
    1.6180
x =
         987        1597
        1597        2584
tf =
     1
tf =
     0
phi =
    1.6180
x =
        1597        2584
        2584        4181
tf =
     1
tf =
     0
phi =
    1.6180
x =
        2584        4181
        4181        6765
tf =
     1
tf =
     0
phi =
    1.6180
x =
        4181        6765
        6765       10946
tf =
     1
tf =
     0
phi =
    1.6180
x =
        6765       10946
       10946       17711
tf =
     1
tf =
     0
phi =
    1.6180
x =
       10946       17711
       17711       28657
tf =
     1
tf =
     0
phi =
    1.6180
x =
       17711       28657
       28657       46368
tf =
     1
tf =
     0
phi =
    1.6180
x =
       28657       46368
       46368       75025
tf =
     1
tf =
     0
phi =
    1.6180
x =
       46368       75025
       75025      121393
tf =
     1
tf =
     0
phi =
    1.6180
x =
       75025      121393
      121393      196418
tf =
     1
tf =
     0
phi =
    1.6180
x =
      121393      196418
      196418      317811
tf =
     1
tf =
     0
phi =
    1.6180
x =
      196418      317811
      317811      514229
tf =
     1
tf =
     0
phi =
    1.6180
x =
      317811      514229
      514229      832040
tf =
     1
tf =
     0
phi =
    1.6180
x =
      514229      832040
      832040     1346269
tf =
     1
tf =
     0
phi =
    1.6180
x =
      832040     1346269
     1346269     2178309
tf =
     1
tf =
     0
phi =
    1.6180
x =
     1346269     2178309
     2178309     3524578
tf =
     1
tf =
     0
phi =
    1.6180
x =
     2178309     3524578
     3524578     5702887
tf =
     1
tf =
     0
phi =
    1.6180
x =
     3524578     5702887
     5702887     9227465
tf =
     1
tf =
     0
phi =
    1.6180
x =
     5702887     9227465
     9227465    14930352
tf =
     1
tf =
     0
phi =
    1.6180
x =
     9227465    14930352
    14930352    24157817
tf =
     1
tf =
     0
phi =
    1.6180
x =
    14930352    24157817
    24157817    39088169
tf =
     1
tf =
     0
phi =
    1.6180
x =
    24157817    39088169
    39088169    63245986
tf =
     1
tf =
     0
phi =
    1.6180
x =
    39088169    63245986
    63245986   102334155
tf =
     1
tf =
     0
phi =
    1.6180
x =
    63245986   102334155
   102334155   165580141
tf =
     1
tf =
     0
phi =
    1.6180
x =
   102334155   165580141
   165580141   267914296
tf =
     1
tf =
     0
phi =
    1.6180
x =
   165580141   267914296
   267914296   433494437
tf =
     1
tf =
     0
phi =
    1.6180
x =
   267914296   433494437
   433494437   701408733
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+09 *
    0.4335    0.7014
    0.7014    1.1349
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+09 *
    0.7014    1.1349
    1.1349    1.8363
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+09 *
    1.1349    1.8363
    1.8363    2.9712
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+09 *
    1.8363    2.9712
    2.9712    4.8075
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+09 *
    2.9712    4.8075
    4.8075    7.7787
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+10 *
    0.4808    0.7779
    0.7779    1.2586
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+10 *
    0.7779    1.2586
    1.2586    2.0365
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+10 *
    1.2586    2.0365
    2.0365    3.2951
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+10 *
    2.0365    3.2951
    3.2951    5.3316
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+10 *
    3.2951    5.3316
    5.3316    8.6268
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+11 *
    0.5332    0.8627
    0.8627    1.3958
tf =
     1
tf =
     0
phi =
    1.6180
x =
   1.0e+11 *
    0.8627    1.3958
    1.3958    2.2585
tf =
     1