Scalar multiplication of a vector

2 次查看(过去 30 天)
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?

采纳的回答

Andrei Bobrov
Andrei Bobrov 2014-3-18
编辑:Andrei Bobrov 2014-3-18
bsxfun(@times,[a b],[x1 y1; x2, y2; x3 y3])
here a, b, x1, y1, x2, y2,x3, y3 - numeric

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by