% Script P2

clc
randn('seed',0)
m = 100; n = 3;
B = randn(m,n); v0 = randn(n,1); e = ones(m,1);
[Q0,R] = qr(randn(n,n));
delta = .01;
A = (B + e*v0')*Q0 + delta*randn(m,n);

[Q,v] = MinPhi(A,B);
Q = Q
Q0 = Q0
v = v
v0 = v0
minNorm = norm(A-(B + e*v')*Q,'fro')