creating function that will accept input argument and return out argument
Afficher commentaires plus anciens
how to Create a function called square() which will accept one input argument and return the squared value of the input argument as an output argument (result)
Réponses (2)
Sulaymon Eshkabilov
le 5 Juin 2021
function OUT = SQUARE(a)
OUT = a.^2;
end
2 commentaires
Walter Roberson
le 5 Juin 2021
... it was a homework question (I have seen it before.)
On the other hand, it is such a simple homework question that it is difficult to resist just giving the solution.
Sulaymon Eshkabilov
le 5 Juin 2021
@Walter: I will take a note on this issue. You are right on hw assignments. Thanks.
OUT = 2.^2
1 commentaire
DGM
le 21 Nov 2021
That's not a function. How does this answer the question?
Catégories
En savoir plus sur Get Started with MATLAB 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!