IN MATLAB
a function that performs guassian elimination without partial pivoting. Using matrix size of 1000x1000 with random numbers in the interval [-0.5,0.5]. Initialize the right hand side by computing b = Az with all z values = 1. Use tic and toc to measure execution time.
`Hey,
Note: If you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
clc%clears screen
clear all%clears history
close all%closes all files
format long
A=rand(1000,1000)-0.5;
b=A*ones(1000,1);
tic;
z = Gauss_npvt(A, b);
disp('Time taken is');
toc
function x = Gauss_npvt(A, b)
[n, n] = size(A); % Find size of matrix A
[n, k] = size(b); % Find size of matrix b
x = zeros(n,k); % Initialize x
for i = 1:n-1
m = -A(i+1:n,i)/A(i,i); % multipliers
A(i+1:n,:) = A(i+1:n,:) + m*A(i,:);
b(i+1:n,:) = b(i+1:n,:) + m*b(i,:);
end;
% Use back substitution to find unknowns
x(n,:) = b(n,:)/A(n,n);
for i = n-1:-1:1
x(i,:) = (b(i,:) - A(i,i+1:n)*x(i+1:n,:))/A(i,i);
end
end

Kindly revert for any queries
Thanks.
IN MATLAB a function that performs guassian elimination without partial pivoting. Using matrix size of 1000x1000...