how to create n*n upper triangular matrix with conditions? (image attached)
Show older comments
Accepted Answer
More Answers (1)
Matei Roca
on 14 Apr 2021
0 votes
m = input ('m=');
n= input('n=')
a=zeros(m,n);
for i=1:m
fprintf('Linia %g : ', i);
a ( i, :)= input ( ' ' ) ;
end
for i=1:m
for j=1:n
if i < j
a (i,j) = 0
end
end
end
fprintf(' Matrice superior triunghiulara ' )
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!