Question: Write a function x = backSubst ( Z , y , k ) that performs back - substitution recursively to solve Zx = y .

Write a function x = backSubst(Z, y, k) that performs back-substitution recursively to solve Zx = y.(ALLOW one loop) here is example of forward substitution
function y = fwdSubst(L,b,k)
%Foward substitution
[m,n]=size(L);
if ~exist('k')% If first call no k param given, but k=1
k=1;
end
y=b(k)/L(k,k);
if k < n % Recursion step
l =[zeros(k,1);L(k+1:m,k)];
y =[y;fwdSubst(L,b-y*l,k+1)];
end
2. here is already function:
function [A, B]= elimmat(Ag, g)
% Assuming Ag is a square matrix
n = size(Ag,1);
% Initialize elimination matrices
A = eye(n);
B = eye(n);
% Perform elimination
A(:, g)=-Ag(:, g)/ Ag(g, g);
B(:, g)= Ag(:, g)/ Ag(g, g);
end
Write function [L, U]= myLU(A) that reuses elimMat to give an LU factorization of A.
get matrix L and matrix U.(allow one loop)
3. write m-file script to execute program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!