How to display the vector in this question?
Show older comments
Write a function func that will receive one input argument x.
If x is a scalar, the function will return its square root, provided x is non-negative.
If x<0, print an error message: “Error Message: You entered a negative number”.
If x is a vector, the function returns the sum of its components.
If x is a square matrix, the function returns its symmetric part.
If x is a rectangular matrix, the function returns the product of its number of rows and number of columns.
3 Comments
Walter Roberson
on 31 Oct 2017
What if x is a square matrix but not symmetric ?
Walter Roberson
on 31 Oct 2017
The question does not ask you to display anything, only to return particular values.
Ariel Chou
on 31 Oct 2017
Answers (0)
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!