title: Gram Schmidt Orthonormalisation
body: <p>I am writing the following code for Gram Schmidt Orthogonalization. It says that there's an error in calling the function. What's the error and how to rectify it?</p>
  
  <pre><code>A =[1,1,1,1;-1,4,4,-1;4,-2,2,0];
  A =A';
  B=myGramschmidt(A);
  
  function [B] = myGramschmidt(A)
  x1=A(:,1);
  x2=A(:,2);
  
  x3=A(:,3);
  v1=x1;
  c = dot(v1);
  v2 = x2-((dot(x2,v1)/c)* v1);
  d = dot(v2);
  v3 = x3-((dot(x3,v1)/c)* v1)-((dot(x3,v2)/d)* v2);
  C=[v1,v2,v3];
  V1=normc(v1);
  V2=normc(v2);
  V3=normc(v3);
  B=[V1,V2,V3];
  end
  </code></pre>