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 visualización (últimos 30 días)
%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

Respuesta aceptada

Ayush Gupta
Ayush Gupta el 17 de Sept. de 2020
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

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by