function demofunfun % DEMOFUNFUN demonstration of function functions disp('Starting demo of function functions...'); name = input('Enter the name of a function as a STRING: ','s'); % example: user enters 'cos' plotf(name,linspace(-10,10,10000)); function plotf(name,x) % evaluate the function with name NAME with input X % FEVAL evaluates a function with given inputs y = feval(name,x); % we could also use less efficient EVAL(STRING) which % evaluates STRING as a script command % now plot the values: plot(x,y);