Write a MATLAB code that generates a random upper-triangular matrix U of size n.

조회 수: 12 (최근 30일)
I am new to MATLAB and not sure how to start. please help. Write a MATLAB code that generates a random upper-triangular matrix U of size n.
  댓글 수: 2
Guillaume
Guillaume 2017년 4월 13일
" not sure how to start"
By making an effort? This, or something similar, is going to be covered in any book or tutorial about matlab within the first few chapters if not the first.

댓글을 달려면 로그인하십시오.

답변 (2개)

Andrei Bobrov
Andrei Bobrov 2017년 4월 13일
out = triu(rand(n))

KSSV
KSSV 2017년 4월 13일
n = 10 ;
A = zeros(n) ;
for i = 1:n
for j = 1:n
if i<j
A(i,j) = rand ;
end
end
end
Also check triu

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by