How to multiply 22x1 double with scalar?

3 visualizaciones (últimos 30 días)
Bersin Tekmen
Bersin Tekmen el 30 de Abr. de 2022
Comentada: Bersin Tekmen el 30 de Abr. de 2022
Hi
I want to multiply like in the following code:
delta_x(i) = dx(i).*1.5;
type of dx is 22x1 double. 1.5 is scalar as you can see. When I do it like shown I get 22x1 double consisting of zeros. How do I have to multiply it, to get the right answer?
Thanks a lot
  1 comentario
Torsten
Torsten el 30 de Abr. de 2022
If dx = 0 for all i, getting all zeros for delta_x is the right answer.

Iniciar sesión para comentar.

Respuesta aceptada

Torsten
Torsten el 30 de Abr. de 2022
If dx = 0 for all i, getting all zeros for delta_x is the right answer.
If you want to multiply delta_x by a scalar in a loop, use
delta_x(i ) = delta_x(i)*1.5;
  3 comentarios
Torsten
Torsten el 30 de Abr. de 2022
One has to see the context - please include the relevant part of your code.
Bersin Tekmen
Bersin Tekmen el 30 de Abr. de 2022
@Torsten thanks I solved the problem. I used the wrong counter variable.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by