How can I use the Modified Gram Schmidt code below

function [Q,R]=mgs(A)
[m,n]=size(A);
V=A;
Q=zeros(m,n);
R=zeros(n,n);
for i=1:n
R(i,i)=norm(V(:,i));
Q(:,i)=V(:,i)/R(i,i);
for j=i+1:n
R(i,j)=Q(:,i)'*V(:,j);
V(:,j)=V(:,j)-R(i,j)*Q(:,i);
end
end
to nu- merically orthogonalize basis functions 1, x, x2, x3, x4, · · · , xn on interval [−1, 1]. In dis- crete sense, those basis functions can be sampled on m equally spaced points on [−1, 1]. and to plot resulting orthogonalized basis on [−1, 1].

Réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by