Info

This question is closed. Reopen it to edit or answer.

while running this simple matlab function program, it is showing error. please anyone spot the error. it is showing ,Error using myfact (line 3) Not enough input arguments.

1 view (last 30 days)
function result= myfact(n,x)
c =1;
vec =[1:n];
c =[1,1./vec];
b =[1,x.^vec];
result =(c.*b);
end

Answers (1)

Steven Lord
Steven Lord on 1 Aug 2016
You called your function with no input arguments, just typing this in the Command Window:
myfact
You need to pass in values for n and x so that your myfact function can use them. For example:
myfact(5, 1/2)

Community Treasure Hunt

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

Start Hunting!