Form a Matrix dependent of iterations

1 visualización (últimos 30 días)
Abdulmohsen Alhuwaimel
Abdulmohsen Alhuwaimel el 19 de Feb. de 2021
Comentada: Rik el 19 de Feb. de 2021
How to Form a Matrix dependent of iterations and the loop command must be while.
Equation used is
Both i and j begin from 1 and end at 5

Respuestas (1)

Rik
Rik el 19 de Feb. de 2021
I'm going to assume your question is a homework assignment. That is why I will ignore the requirement of using a while loop, as a for loop or a vectorized solution is a much better idea.
[x,y]=ndgrid(1:5);
A=(2.^x).*y;
You can find guidelines for posting homework on this forum here. If this is a homework question, this answer should be completely useless and prompt you to put in some effort. If it isn't homework, you now have a much better solution.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by