Scalar multiplication of a vector

3 Ansichten (letzte 30 Tage)
Jonathan
Jonathan am 18 Mär. 2014
Bearbeitet: Andrei Bobrov am 18 Mär. 2014
Hello everyone,
I want to write a program using as little for-loops as possible. I want to define the following multiplication:
[a b] * [x1 y1; x2, y2; x3 y3] = [a*x1 b*y1; a*x1 b*y1; a*x1 b*y1]
Can i do this without the use of for-loops?

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 18 Mär. 2014
Bearbeitet: Andrei Bobrov am 18 Mär. 2014
bsxfun(@times,[a b],[x1 y1; x2, y2; x3 y3])
here a, b, x1, y1, x2, y2,x3, y3 - numeric

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by