MATLAB Answers

Please write the code for this question.

108 views (last 30 days)
Given a Matrix A,
  • Create a row vector of 1's that has same number of elements as A has rows.
  • Create a column vector of 1's that has the same number of elements as A has columns.
  • Using matrix multiplication, assign the product of the row vector, the matrix A, and the column vector (in this order) to the variable result.
  • A = [1:5; 6:10; 11:15; 16:20];

Accepted Answer

Manali Gupta
Manali Gupta on 4 Jun 2019
R_vector = ones(1,size(A,1));
C_vector=ones(size(A,2),1);
result = R_vector*A*C_vector;

  0 Comments

Sign in to comment.

More Answers (1)

Alex Mcaulley
Alex Mcaulley on 4 Jun 2019
I think the goal of this forum is not to do anyone's homework, but to solve generic questions about Matlab that can help more users. This exercise is very simple, anyone who has ever used Matlab could do it, so, I think the best thing we can do is help @Gaurav to know how to learn the basics of Matlab.

  0 Comments

Sign in to comment.

Sign in to answer this question.

Products


Release

R2017b