what is the complexity of my gauss algorithm and how was it gotten step by step
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!