Borrar filtros
Borrar filtros

multiplying or dividing vectors

2 visualizaciones (últimos 30 días)
Sean Smith
Sean Smith el 8 de Sept. de 2011
I am missing something and I can't figure out what to do. I am trying to divide these 2 vectors. So I want the first number in vector one divided by the first in vector 2. The second in vector 1 divided by the second in vector 2. I get this error Error: Unbalanced or unexpected parenthesis or bracket. Where am I messing up with the syntax? I know its the "speedf." but I don't know how else to write it. Thank You.
speed=[10 20 30 40 50 60 70];
speedf=[speed.*5290/86400];
rd=[11 22 33 44 55 66 77];
rxt=[rd./speedf.]

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 8 de Sept. de 2011
speed = 10:10:70;
speedf = speed * (5290/86400);
rd = 11:11:77;
rxt = rd./speedf;
The error was just the point after rd./speedf.
I suggest:
  • do not abuse the parentheses
  • try to understand when to use .* or *
  6 comentarios
Oleg Komarov
Oleg Komarov el 9 de Sept. de 2011
@Sean: of course, what did you expect? Algebra.
Oleg Komarov
Oleg Komarov el 9 de Sept. de 2011
rxt = (11:11:77)./((10:10:70) * (5290/86400)); --> (5290/86400)^-1 * 1.1

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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