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

# Solution 101663

Submitted on 22 Jun 2012 by Richard Zapor

Correct

34Size
`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

```%%
format long
v=[-2; 0.22-0.54i ; 0.25-.54i ; 0.26 ;.125+.125i; 0.25];
tf=isMandelbrot(v);
tf_expected=[1 ; 0 ; 1 ; 0 ; 1 ; 1] ;
assert(isequal(tf,tf_expected),sprintf('\n%f %f %f %f %f %f',tf,tf_expected))
```

2
Pass

```%%
v=-.25*ones(6,1)+(rand(6,1)-.5)/2+i*(rand(6,1)-.5)/2
%v=[-.5-.25i;-.5+.25i;-.25i;.25i;-.25-.25i;-.25+.25i]
% Bounding Cases
tf=isMandelbrot(v);
tf_expected=[1 ; 1 ; 1 ; 1 ; 1 ; 1] ;
assert(isequal(tf,tf_expected),sprintf('\n%f %f %f %f %f %f',tf,tf_expected))
```
```v =
-0.157358702704152 - 0.077934303818224i
-0.318561270814751 - 0.136758387782191i
-0.483026478941688 - 0.067293636971914i
-0.050956633247426 + 0.040156585738521i
-0.499436570246109 - 0.028672285994603i
-0.040812105584987 + 0.037332734438952i
```
3
Pass

```%%
v=rand(6,1)-0.25
tf=isMandelbrot(v);
tf_expected=v<=0.25; % non-imaginary range [-2.0,0.25]
assert(isequal(tf,tf_expected),sprintf('\n%f %f %f %f %f %f',v,tf,tf_expected))
```
```v =
0.293901431800929
0.380413860152151
0.639229107299068
0.291687392919774
0.726396264809828
0.142380405064416
```