Question: We want to write a function that would make any input square matrix symmetric and return a symmetrized version of it. Remember fromlecture 3 that(A+A')/2

We want to write a function that would make any input square matrixsymmetricand return a symmetrized version of it. Remember fromlecture 3 that(A+A')/2 is the symmetric part of matrix A.

Write a simple Matlab function namedsymmetrize that

  • accepts one argument named A, which is a square matrix (we assume all inputs are square, so you don't need to check this)
  • The function returns a symmetric version of the matrix, call itres,by replacing every element A(i,j) of the matrix with the average of A(i,j) and A(j,i) usingfor loops
  • The function should have a short description as the first line of comments and a lengthier (but no more than three lines) description that explains what the argument is, what the function does, the name of the author and date. (Remember that this information will be available as on-line documentation and whoever reads it does not always have access to the code. )

For example, (you can test this in command window to check if your code works correctly):

if this is your input matrix:

We want to write a function that would make any input squarematrixsymmetricand return a symmetrized version of it. Remember fromlecture 3 that(A+A')/2 is

\f\f

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!