matlab matrix with specific elements

1 visualización (últimos 30 días)
Mohannad Almalki
Mohannad Almalki el 16 de Oct. de 2020
Comentada: Asad (Mehrzad) Khoddam el 16 de Oct. de 2020
i want to create an m by n matricx and its elements are write by this firmula
a(i, j) = (j − 4)2 (i + 1)−3 + ij
where i is the row number and j is the column number?

Respuesta aceptada

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam el 16 de Oct. de 2020
assume that i is from 1 to 5 and j is from 1 to 6:
% i: 1 to 5
% j: 1 to 6
[i,j] = meshgrid(1:5,1:6);
a=2*(j-4).*(i+1)-3+i.*j;
disp(a)
  2 comentarios
Mohannad Almalki
Mohannad Almalki el 16 de Oct. de 2020
I want it to be a=((j-4)^2)*((i+1)^-3)+(i+j)
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam el 16 de Oct. de 2020
% i: 1 to 5
% j: 1 to 6
[i,j] = meshgrid(1:5,1:6);
a=(j-4).^2.*(i+1).^-3+i+j;
disp(a)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB 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!

Translated by