Use loops to create a 3 x 5 matrix in which the value of each element is the difference between the indices divided by the sum of its indices (the row num ber and column number of the element). For example, the value of the element (2,5) is (2 – 5)/
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Use loops to create a 3 x 5 matrix in which the value of each element is the difference between the indices divided by the sum of its indices (the row num ber and column number of the element). For example, the value of the element (2,5) is (2 – 5)/(2 + 5) = -0.4286.
Respuestas (1)
David Hill
el 24 de Oct. de 2020
[a,b]=ind2sub([3 5],1:15);
m = reshape((a-b)./(b+a),[3],[5]);
0 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!