User Defined Functions calling
1 view (last 30 days)
Show older comments
Hello experts,
Am creating a user defined function, like the below with a file name as (myfunc.m)
function outcome = myfunc(x, a, b, c)
outcome = 2*(x.^2) + 3*x + a + b + c ;
end
Calling it in the another program with file name Prog1.m
for n = 1:5
x = n*0.1;
z = myfunc(x,2,3,7);
fprintf('x = %4.2f f(x) = %8.4f \r',x,z)
end
Am using the latest version of MATLAB, 2020, would like to know if any errors or modification needed in the code to correct it.
4 Comments
Answers (0)
See Also
Categories
Find more on Smoothing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!