Is this correct?
Mostra commenti meno recenti
(a) Write a MATLAB function matrixfn that takes values m and n as inputs and gives as output an m × n matrix A whose entries Aij are defined by Aij = i^2 + j^2
(b) Write MATLAB commands that use matrixfn to obtain the m × n matrix A for the following cases: (i) m = n = 5. (ii) m = 6, n = 9
THIS IS WHAT I HAVE DONE:
function A= matrixfn(m,n)
for i=1:n
for j=1:m
A(i,j)=i^2 + j^2;
end
end
2 Commenti
Walter Roberson
il 12 Nov 2018
Your output would be n x m instead of m x n
Tawanda Le Bourne
il 12 Nov 2018
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!