Professional Documents
Culture Documents
DownloadClassSessionFile - 2024-02-26T205018.271
DownloadClassSessionFile - 2024-02-26T205018.271
College of Engineering
Software and Informatics Engineering Department
Second Year Class
Numerical Analysis
and
Probability
M Function
Lecturer
Kanar Shukr Muhamad
2023-2024
Function
Functions let you do a specific task. User defined functions
2
Function
Declaration function
End
3
Function
After writing the function and saving the file as
the function name, write the function name and
gives value(s) to its parameter call and execute the
function in the command window.
4
Function
Ac12: Write a M function that takes a number and return sqrt of
it.
5
Activities
Ac13/ Write a M function that takes a number, return sqrt
7
Activities
Ac15/ Write a function named quadratic that would
function [r1,r2]=sub(a,b,c)
r1=(-b-sqrt(b^2-4*a*c))/(2*5);
r2=(-b+sqrt(b^2-4*a*c))/(2*5);
end