Cody

# Problem 1108. Raise Matrix to Power

Solution 176727

Submitted on 13 Dec 2012
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
%% filetext = fileread('matpow.m'); assert(isempty(strfind(filetext, '^'))) assert(isempty(strfind(filetext, 'mpower')))

```Error: You may not use the command(s) str2func in your code ```

2   Fail
%% x=[1 2; -1 2]; y_correct=x^5; y=matpow(x,5); assert(max(abs(y(:)-y_correct(:)))<1e-5)

```Error: You may not use the command(s) str2func in your code ```

3   Fail
%% x=[1 2; -1 2]; y_correct=x^-3.5; y=matpow(x,-3.5); assert(max(abs(y(:)-y_correct(:)))<1e-5)

```Error: You may not use the command(s) str2func in your code ```

4   Fail
%% x=[1 2 3; 4 2 -1; -2 4 -3]; y_correct=x^6; y=matpow(x,6); assert(max(abs(y(:)-y_correct(:)))<1e-5)

```Error: You may not use the command(s) str2func in your code ```

5   Fail
%% x=[1 2 3; 4 2 -1; -2 4 -3]; y_correct=x^-4; y=matpow(x,-4); assert(max(abs(y(:)-y_correct(:)))<1e-5)

```Error: You may not use the command(s) str2func in your code ```