what is the complexity of my gauss algorithm and how was it gotten step by step
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi I av this function and I want to find its complexity but don't know how to calculate it pls can anyone help plus is there a method that can be used to calculate this in MATLAB
function [x,U] = gausselim(A,b) % function to perform gauss eliminination %FORWARD ELIMINATION n=length(b); m=zeros(n,1); x=zeros(n,1); for k =1:n-1; %compute the kth column of M m(k+1:n) = A(k+1:n,k)/A(k,k); %compute An=Mn*An-1, bn=Mn*bn-1 for i=k+1:n; A(i, k+1:n) = A(i,k+1:n)-m(i)*A(k,k+1:n); end; b(k+1:n)=b(k+1:n)-b(k)*m(k+1:n); end; U= triu(A);
%BACKWARD ELIMINATION x(n)=b(n)/A(n,n); for k =n-1:-1:1; b(1:k)=b(1:k)-x(k+1)* U(1:k,k+1); x(k)=b(k)/U(k,k); end; end
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!