MATLAB Answers

Please write the code for this question.

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];

  댓글 수: 1

로그인 to comment.

제품


릴리스

R2017b

답변 수: 2

Answer by Manali Gupta on 4 Jun 2019
 Accepted Answer

R_vector = ones(1,size(A,1));
C_vector=ones(size(A,2),1);
result = R_vector*A*C_vector;

  댓글 수: 0

로그인 to comment.


Answer by 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

로그인 to comment.



Translated by