Matrix Division: Different sized matrices

8 次查看(过去 30 天)
I have one matrix A = [745 678]. I have another matrix B = [745 1].
I want to compute A / B. I want the result to be a [745 678] matrix. So basically every row in A (from 1 to 678) will be divided by the column matrix B. The end result will be all the matrix elements of A divided by the matrix elements of B.

采纳的回答

Walter Roberson
Walter Roberson 2019-6-7
In R2016b or later,
A ./ B
In earlier releases,
bsxfun(@rdivide, A, B)
  5 个评论
Articat
Articat 2019-6-10
Was able to figure it out by using the function repmat()
Jan
Jan 2019-6-10
@Lane Dillon: repmat is most likely the least efficient method to solve the problem.

请先登录,再进行评论。

更多回答(1 个)

John D'Errico
John D'Errico 2019-6-7
Is there a reason why you have not read the getting started tutorials? The manual is always a good thing to read.
C = A./B;

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by