multiply a number to only a row in a matrix

21 visualizaciones (últimos 30 días)
Panda Girl
Panda Girl el 16 de Nov. de 2018
Respondida: perihane el 12 de Mzo. de 2023
  • o =
  • 3×16 logical array
  • 1 1 0 0 1 1 1 0 1 0 1 1 1 1 0 1
  • 0 0 1 0 1 0 1 0 1 1 1 0 1 1 1 0
  • 1 1 0 1 0 0 1 1 0 1 1 0 0 0 0 1
  • volts0 = ((-5 + 10*(out_data))*0.35)
  • volts0 =
  • Columns 1 through 12
  • 1.7500 1.7500 -1.7500 -1.7500 1.7500 1.7500 1.7500 -1.7500 1.7500 -1.7500 1.7500 1.7500
  • -1.7500 -1.7500 1.7500 -1.7500 1.7500 -1.7500 1.7500 -1.7500 1.7500 1.7500 1.7500 -1.7500
  • 1.7500 1.7500 -1.7500 1.7500 -1.7500 -1.7500 1.7500 1.7500 -1.7500 1.7500 1.7500 -1.7500
I am trying to do the multiplication only on row1 but when I execute the syntax for volts0 it takes the entire matrix. How should I write this piece if I want to perform the multiplication only to row 1
Similarly i am trying to do for row 2 and 3 but with different numbers
please help

Respuestas (2)

madhan ravi
madhan ravi el 17 de Nov. de 2018
volts0(1,:)*4 % here first row is multiplied by a scalar number like you wanted
  2 comentarios
Panda Girl
Panda Girl el 19 de Nov. de 2018
instead of the number 4 can I multiply with a random number ??
As the significance of the number 4 here is nothing but noise which is which distorts the signal and considering noise as a random variable I was trying to multiply a random number that would help me to respresent the problem statement more efficiently.
madhan ravi
madhan ravi el 20 de Nov. de 2018
just put rand(decimal value) or randi(integer value) in the place of 4

Iniciar sesión para comentar.


perihane
perihane el 12 de Mzo. de 2023
volts0(1,:)*4

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by