function [Q,R] = cgs(A)
[m,n] = size(A);
Q = A; R = zeros(n);
for k = 1:n
R(1:k-1,k) = Q(:,1:k-1)'*A(:,k);
Q(:,k) = A(:,k)- Q(:,1:k-1)*R(1:k-1,k);
R(k,k) = norm(Q(:,k));
Q(:,k) = Q(:,k)/R(k,k);
end
end
please how to call this function 1000times?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 3 de Abr. de 2019

0 votos

A = .... whatever is appropriate
for iteration = 1 : 1000
[Q,R] = cgs(A);
end
This would not appear to make much sense to do unless you are changing A between iterations, or unless you are doing this in order to time the execution. If you are doing this for timing purposes then we would recommend that you instead use
timing = timeit(@() cgs(A), 2)

Más respuestas (0)

Categorías

Más información sobre Genomics and Next Generation Sequencing en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 3 de Abr. de 2019

Respondida:

el 3 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by