|
Hi, I've been trying to implement Gram Schmidt orthogonalization for calculating lyapunov exponents. However, I find that I slowly lose orthogonality over about 1000 time steps; I think it may be due to normalization after each orthogonalization step. Below is my code:
%Gram-Schmidt orthogonalization and normalization
orthcol=Jacobianmatrix;
orthcol(:,1)=orthcol(:,1)/sqrt(transpose(orthcol(:,1))*(orthcol(:,1)));
for jj=2:3 %for 2nd and 3rd vectors
for kk=1:jj-1
orthcol(:,jj)=orthcol(:,jj)-dot(orthcol(:,jj),orthcol(:,kk))...
/sqrt(transpose(orthcol(:,kk))*(orthcol(:,kk)))*orthcol(:,kk);
end
orthcol(:,jj) = orthcol(:,jj)/sqrt(transpose(orthcol(:,jj))*(orthcol(:,jj))); %normalize
end
Any help would be really appreciated. Thanks!
My previous program implemented the classical Gram-Schmidt and that didn't work either.
|