![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/599370/image.jpeg)
How to go about programming this function in MatLab
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to program a function into matlab but I am struggling to get started. I want to program it as a function and not as part of a script so that I may use it later on when I need it.
Basicaly, there will be n number of terms, and x and y are arrays that will change in size depending on how have set them up.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/609590/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/609590/image.jpeg)
2 commentaires
Stephen23
le 28 Avr 2021
Modifié(e) : Stephen23
le 28 Avr 2021
Original question retrieved from Google Cache:
I am trying to program a function into matlab but I am struggling to get started. I want to program it as a function and not as part of a script so that I may use it later on when I need it.
Basicaly, there will be n number of terms, and x and y are arrays that will change in size depending on how have set them up.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/599370/image.jpeg)
Réponses (2)
Jan
le 20 Avr 2021
function c = YourSum(x, y, a, b)
c = sum(sqrt((a - x).^2 + (b - y).^2));
end
0 commentaires
Voir également
Catégories
En savoir plus sur Environment and Settings 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!