Matrix sequence go diagonal
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ainars Cernavskis
el 18 de Jul. de 2021
Comentada: Rena Berman
el 27 de Nov. de 2023
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 comentarios
Sam Chak
el 23 de Nov. de 2023
The original question may be beneficial for people who wish to learn how to fill a vector sequence with desired values.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1550857/image.png)
Respuesta aceptada
Image Analyst
el 18 de Jul. de 2021
This isn't your homework is it? Try this:
% 1,3,10,33,109,360
vec = [1,3,10,33,109,360]
for k = 1 : length(vec)
fprintf('%d, ', vec(k) + 3);
end
fprintf('\n');
You get:
vec =
1 3 10 33 109 360
4, 6, 13, 36, 112, 363,
Is that what you want? And why do you want this? What's the use case?
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!