Matrix sequence go diagonal
이전 댓글 표시
Hi am ,trying to write a function which would display following sequences diagnaly :
1,3,10,33,109,360 [EDITED]
But am not sure how to do that , i have done a little bit,but am now stuck ( am kinda new to matlab and was just trying to learn it for the future ), any help would be great .
Or even if you could show me a refference which i could go of of , would be good too .
댓글 수: 6
Image Analyst
2021년 7월 18일
"display following sequences" <=== What sequences? You never showed the example. In the meantime, try fprintf();
for k = 1 : 10
fprintf('%sX\n', repmat(' ', 1, k));
end
Ainars Cernavskis
2021년 7월 18일
Jan
2021년 7월 18일
Please post, what you have tried so far. How many elements do you want to produce?
Ainars Cernavskis
2021년 7월 18일
Sam Chak
2023년 11월 23일
The original question may be beneficial for people who wish to learn how to fill a vector sequence with desired values.

Rena Berman
2023년 11월 27일
(Answers Dev) Restored edit
채택된 답변
추가 답변 (1개)
n = 6; % Or if you want: input ('sequence_matrix_');
v = zeros(1, n+1); % Pre-allocation
v(2) = 1; % Initial values: [0, 1]
for k = 2:n
v(k + 1) = v(k) * 3 + v(k - 1);
end
v(1) = [] % Remove leading zero
카테고리
도움말 센터 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!