Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 217 characters in body
Source Link
foxtrot9
  • 581
  • 4
  • 9

Suppose I have a matrix:

A = [ a, b, c; d, e, f ]; 

and a vector:

b = [ x; y; z ]; 

What I want is resultant matrix as:

C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; 

How can I do this? Essentially, I want to multiply matrix (dimension: mxn) with a vector (nx1) and get resultant matrix mxn.

When I do it onAs requested in comments (using octave by usingversion *3.8.0 operator, I receive normal matrix multiplication answer. Example):

octave> A = [ 1,2,3;4,5,6]; B=[10;20;30]; octave> A*B ans = 140 320 octave:14>octave> A.*B error: product: nonconformant arguments (op1 is 2x3, op2 is 3x1) octave:14>octave> bsxfun(@times, A, B) error: bsxfun: nonconformant dimensions: 2x3 and 3x1 

Suppose I have a matrix:

A = [ a, b, c; d, e, f ]; 

and a vector:

b = [ x; y; z ]; 

What I want is resultant matrix as:

C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; 

How can I do this? Essentially, I want to multiply matrix (dimension: mxn) with a vector (nx1) and get resultant matrix mxn.

When I do it on octave by using * operator, I receive normal matrix multiplication answer. Example:

octave> A = [ 1,2,3;4,5,6]; B=[10;20;30]; octave> A*B ans = 140 320 octave:14> A.*B error: product: nonconformant arguments (op1 is 2x3, op2 is 3x1) octave:14> bsxfun(@times, A, B) error: bsxfun: nonconformant dimensions: 2x3 and 3x1 

Suppose I have a matrix:

A = [ a, b, c; d, e, f ]; 

and a vector:

b = [ x; y; z ]; 

What I want is resultant matrix as:

C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; 

How can I do this? Essentially, I want to multiply matrix (dimension: mxn) with a vector (nx1) and get resultant matrix mxn.

As requested in comments (using octave version 3.8.0):

octave> A = [ 1,2,3;4,5,6]; B=[10;20;30]; octave> A*B ans = 140 320 octave> A.*B error: product: nonconformant arguments (op1 is 2x3, op2 is 3x1) octave> bsxfun(@times, A, B) error: bsxfun: nonconformant dimensions: 2x3 and 3x1 
added 217 characters in body
Source Link
foxtrot9
  • 581
  • 4
  • 9

Suppose I have a matrix:

A = [ a, b, c; d, e, f ]; 

and a vector:

b = [ x; y; z ]; 

What I want is resultant matrix as:

C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; 

How can I do this? Essentially, I want to multiply matrix (dimension: mxn) with a vector (nx1) and get resultant matrix mxn.

When I do it on octave by using * operator, I receive normal matrix multiplication answer. Example:

octave> A = [ 1,2,3;4,5,6]; B=[10;20;30]; octave> A*B ans = 140 320 octave:14> A.*B error: product: nonconformant arguments (op1 is 2x3, op2 is 3x1) octave:14> bsxfun(@times, A, B) error: bsxfun: nonconformant dimensions: 2x3 and 3x1 

Suppose I have a matrix:

A = [ a, b, c; d, e, f ]; 

and a vector:

b = [ x; y; z ]; 

What I want is resultant matrix as:

C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; 

How can I do this? Essentially, I want to multiply matrix (dimension: mxn) with a vector (nx1) and get resultant matrix mxn.

Suppose I have a matrix:

A = [ a, b, c; d, e, f ]; 

and a vector:

b = [ x; y; z ]; 

What I want is resultant matrix as:

C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; 

How can I do this? Essentially, I want to multiply matrix (dimension: mxn) with a vector (nx1) and get resultant matrix mxn.

When I do it on octave by using * operator, I receive normal matrix multiplication answer. Example:

octave> A = [ 1,2,3;4,5,6]; B=[10;20;30]; octave> A*B ans = 140 320 octave:14> A.*B error: product: nonconformant arguments (op1 is 2x3, op2 is 3x1) octave:14> bsxfun(@times, A, B) error: bsxfun: nonconformant dimensions: 2x3 and 3x1 
edited body
Source Link
foxtrot9
  • 581
  • 4
  • 9

Suppose I have a matrix:

A = [ a, b, c; d, e, f ]; 

and a scalarvector:

b = [ x; y; z ]; 

What I want is resultant matrix as:

C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; 

How can I do this? Essentially, I want to multiply matrix (dimension: mxn) with dimensiona vector (mn) with a scalar (n1nx1) and get resultant matrix m*nmxn.

Suppose I have a matrix:

A = [ a, b, c; d, e, f ]; 

and a scalar:

b = [ x; y; z ]; 

What I want is resultant matrix as:

C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; 

How can I do this? Essentially, I want to multiply matrix with dimension (mn) with a scalar (n1) and get resultant matrix m*n.

Suppose I have a matrix:

A = [ a, b, c; d, e, f ]; 

and a vector:

b = [ x; y; z ]; 

What I want is resultant matrix as:

C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; 

How can I do this? Essentially, I want to multiply matrix (dimension: mxn) with a vector (nx1) and get resultant matrix mxn.

Source Link
foxtrot9
  • 581
  • 4
  • 9
Loading