How to display the vector in this question?
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 31 Oct 2017
What if x is a square matrix but not symmetric ?
Walter Roberson
le 31 Oct 2017
The question does not ask you to display anything, only to return particular values.
Ariel Chou
le 31 Oct 2017
Réponses (0)
Catégories
En savoir plus sur Whos dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!