`% Take a random initial vector of length 1 and orthogonalize it`

`% with respect to the other vectors.`

`if initialStateMode == 0`

`w = randn (vectorSize, 1);`

`elseif initialStateMode == 1`

`w=whiteningMatrix*guess(:,round);`

`end`

`w = w - B * B' * w;`

`w = w / norm(w);`

```
```

```
```
`wOld = zeros(size(w));`

`wOld2 = zeros(size(w));`

```
```

```
```
`% This is the actual fixed-point iteration loop.`

`% for i = 1 : maxNumIterations + 1`

`i = 1;`

`gabba = 1;`

`while i <= maxNumIterations + gabba`

`if (usedDisplay > 0)`

`drawnow;`

`end`

```
```

```
```
`% Project the vector into the space orthogonal to the space`

`% spanned by the earlier found basis vectors. Note that we can do`

`% the projection with matrix B, since the zero entries do not`

`% contribute to the projection.`

`w = w - B * B' * w;`

`w = w / norm(w);`

```
```

```
```
`if notFine`

`if i == maxNumIterations + 1`

` if b_verbose`

` fprintf('\nComponent number %d did not converge in %d iterations.\n', round, maxNumIterations);`

` end`

` round = round - 1;`

` numFailures = numFailures + 1;`

` if numFailures > failureLimit`

` if b_verbose`

` fprintf('Too many failures to converge (%d). Giving up.\n', numFailures);`

` end`

` if round == 0`

` A=[];`

` W=[];`

` end`

` return;`

` end`

` % numFailures > failurelimit`

` break;`

```
```

```
```This iteration will guess a row of the demixing matrix (w in the code) and then run through a loop until it finds a projection that agrees with the statistical analysis behind the decoding.
After running on the supplied mixed signals, the program will output what it thinks are the two original sources and the demixing matrix. We can then use these outputs to complete a variety of tasks such as removing noise from the original signals, matching the original signals with other signals to detect base elements of the mixed signal, or even just simply outputting the original signals through a speaker system.

```
```

```
```

```
```

```
```