how to define a function in matlab so that we can call it?

2 vues (au cours des 30 derniers jours)
Monali
Monali le 20 Jan 2015
Modifié(e) : Stephen23 le 20 Jan 2015
e.g. function [e,w]=blocklms (mu,M,u,d);

Réponse acceptée

Stephen23
Stephen23 le 20 Jan 2015
Modifié(e) : Stephen23 le 20 Jan 2015
Basic function syntax is like this:
function [e,w] = blocklms(mu,M,u,d)
% Your code here:
e = mu*M;
W = u-d;
%
end
Save this in an M-file with the same name as the function itself, and then you can call your function from the command line, a script, or from any other function. For more information read the documentation, which also includes lots of nice examples:

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by