I need help in developing a function file GE_m(A,b) to determine the pivot row r such that a(rk) is the first nonzero entry among a(kk),a(k+1)...a(n,k). if a(kk)=a(k+1,k)=a(nk)=0 then pivot out that 'A is not invertible' and quit.
1 次查看(过去 30 天)
显示 更早的评论
%I need help in developing a function file GE_m(A,b) to determine the pivot row r
% such that a(rk) is the first nonzero entry among a(kk),a(k+1)...a(n,k).
% if a(kk)=a(k+1,k)=a(nk)=0 then pivot out that 'A is not invertible' and quit.
% this is the other function i will be calling in my comand window and this function is correct
%function x=ut_sys(U,c)
%n=length(U);
%x=zeros(n,1);
%x(n)=c(n)/U(n,n);
%for i=n-1:-1:1
% s=0;
% for j=n:-1:i+1
%s =s+U(i,j)*x(j);
% end
% x(i) = (c(i)-s) /U(i,i);
%end
%end
% i need help with the function below!! i cannot get it working
function [A,b]=GE_m(A,b)
n =length(b);
for k=1:n-1
ap=abs(A(k,k));
r=k;
while ap < (n)*e-15
r=r+1;
end
end
if ap , (n)*e-15
disp('A is not invertible');
end
end
0 个评论
采纳的回答
Ayush Gupta
2020-9-17
The following problem can be solved by using nested for loop. Refer to the following code to see how to solve this:
function [A,b]=a1(A,b)
n =length(b);
flag = 0;
for k=1:n-1
for i = k:n-1
if(a(k,i) ~= 0)
flag = 1;
end
end
end
if(flag == 1)
disp('A is not invertible')
end
end
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Special Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!