Make Sequence Function go Diagonal
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi ,how would i make this function go diagonal?,any help would be great
n = input ('sequence_matrix_');
fibb=[1,3:n];
for i=3:n
fibb(i)=fibb(i-1)*3+(i)-2;
end
fibb
댓글 수: 2
Sam Chak
2023년 11월 23일
The original question may be beneficial for people who wish to learn how to create a diagonal matrix.
채택된 답변
Sameer Pujari
2021년 7월 19일
Just do this small change
n = input ('sequence_matrix_');
fibb=[1,3:n];
for i=3:n
fibb(i)=fibb(i-1)*3+(i)-2;
end
diag(fibb)
추가 답변 (1개)
Walter Roberson
2021년 7월 19일
n = input ('sequence_matrix_');
fibb = diag([1,3:n]);
for i=3:n
fibb(i,i) = fibb(i-1,i-1)*3+(i)-2;
end
fibb
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Time Series Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!