I am new to Matlab, so there is a lot I do not understand; I have three questions, as followed:
The biggest issue I have revolves around function B= upper_triang(A)
where it states that it is 'a function unused'. Reading through the Matlab tooltip, and I am guessing that it has to do with a value that has not been defined? ANd B of course being unset, but I thought I defined B as a function, so why is it unset? I am assuming that B is U, but in the math part that is ahh, so I am not sure what it would be.
To give context to my code I sent the part of the homework code I have a question on.
%%%This is for part a for problem 1.
A=zeros(8,8);%%%For the size column and row size of matrix A.
for j=1:8
for k=1:8
if j==k
A(j,k)=-2;
end
if abs(j-k)==1
A(j,k)=1;
end
end
end
[L,U]=lu(A); %%%Proving L and U.
L*U; %%%Proving that L*U=A, thus it is correct.
%%%This is for part b for problem 1
function B= upper_triang(A)
%%%Input A--> Matrix for m*n for the size
%%%Output B--> Is the upper triangular matrix of the same size
[m,n]=size(A);
for k=1:m-1
for i=k+1:m
u=A(i,k)/A(k,k);
for j=(k):n
A(i,j)=A(i,j)-u*A(k,j);
end
end
end
B-A;
end