Matrix division "in scalar way"

61 visualizaciones (últimos 30 días)
Mateusz Brzezinski
Mateusz Brzezinski el 31 de Ag. de 2020
Comentada: madhan ravi el 31 de Ag. de 2020
Hello,
I have following formula
X=Y/(Z*2);
Where
Y is a vector predefined 1x200 - let say 1, 2, 3, 4, 5 .... 200
Z is also a vector predefined 1x200 - let say 1, 2, 3, 4, 5 .... 200
If I run it in sacalar I should always get 0.5 (1/(1*2) = 2/(2*2) =...= 200/(200*2)
I would like to get this same kind of results but stored in 1x200 array/vector when I run it as a matrix operation.
So X = [0,5 , 0,5 , .... 0,5]
How to do that?
If I run it like:
X=Y/(Z.*2);
I only get single result
and If I run it like:
X=Y\(Z*2);
I got a nonsense 200x200 matrix.
I will be thankful for any tips!
  1 comentario
Stephen23
Stephen23 el 31 de Ag. de 2020
Editada: Stephen23 el 31 de Ag. de 2020
"I got a nonsense 200x200 matrix."
It is not nonsense, you just used the wrong operation:

Iniciar sesión para comentar.

Respuesta aceptada

Alan Stevens
Alan Stevens el 31 de Ag. de 2020
X = Y ./ (Z .* 2);
Note the dot by the divide sign.
  2 comentarios
Mateusz Brzezinski
Mateusz Brzezinski el 31 de Ag. de 2020
Thanks!
madhan ravi
madhan ravi el 31 de Ag. de 2020
Read the link KSSV and Stephen Cobeldick links, by the way .* is simply *

Iniciar sesión para comentar.

Más respuestas (1)

KSSV
KSSV el 31 de Ag. de 2020
Editada: KSSV el 31 de Ag. de 2020

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by