Create array u(i) that is max of array x(i) and y(i)

Use the MATLAB environment to write an m-file that inputs a positive integer N and N-dimensional arrays x and y and generates a new N-dimensional array, u, defined as: u(i) = max(x(i), y(i)), i=1,2,...,N.
I'm new to MATLAB so I don't know how to set a multidimensional array to N through loops.

Respuestas (1)

Sean de Wolski
Sean de Wolski el 30 de Abr. de 2013
Editada: Sean de Wolski el 30 de Abr. de 2013
x = rand(10,10,10);
y = rand(10,10,10);
mxy = max(x,y)
max() works directly on n-dimensional arrays.
doc max
Welcome to MATLAB and Answers.

La pregunta está cerrada.

Etiquetas

Preguntada:

el 30 de Abr. de 2013

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by