Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %This is posted and ran in a separate file before running the code below.
- A=[-2,1,0,0,0,0,0,0;1,-2,1,0,0,0,0,0;0,1,-2,1,0,0,0,0;0,0,1,-2,1,0,0,0;0,0,0,1,-2,1,0,0;0,0,0,0,1,-2,1,0;0,0,0,0,0,1,-2,1;0,0,0,0,0,0,1,-2];
- %Again, this is posted in a separate file named 'triang'.
- %The issue I am having is the error in live five reads: "Not enough input arguments.Error in triang (line 5)[m,n]=size(A);"
- function B= 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); %This is the line I am having issues with.
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement