斯密特正交化(matlab)

斯密特正交化(matlab)

数学过程

斯密特正交化(matlab)_第1张图片

伪代码如下:


function b =  Gram_Schmidt_Orthogonalization(a)

[row,col]=size(a)

b[1]=a[1]

for i in 2~col

    for j in 1~i-1

        a[i]=a[i]-(b[j].T * a[i])/(b[j].T * b[j]) * b[j]

    b[i]=a[I]

b[i]= b[i]/ length(b[i])

matlab代码


function T = Gram_Schmidt_Orthogonalization(p_tr)

    % 一列为一个向量

    [row,col]= size(p_tr);

    T = zeros(row,col);



    T(:,1)=p_tr(:,1);

    for i = 2 : col

        for j = 1: i-1

            p_tr(:,i)= p_tr(:,i) - ((T(:,j)' * p_tr(:,i))/(T(:,j)' * T(:,j))) * T(:,j);

        end

        T(i)=p_tr(:,i);

    end

    % 向量单位化

    for i = 1: col

        length=norm(T(:,i));

        for j = 1: row

            T(j,i)= T(j,i)/ length;

        end

    end

  end

你可能感兴趣的:(多目标算法)