Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



user defined function and graph plotting
Posted:
Sep 14, 2013 1:06 PM


Dear Colleagues,
Is it possible to write a simple function that takes some arguments and plots a graph? As I have written a simple function to automatically plot graphs for me but they wont generate when I call the function.
Simple example
function = plot_graphs(x, y, n)
% Some data manipulation here  excluded for simplicity %
figure(n)
plot(x, y) title(' Figure n')
When I run this function it wont plot my graph. If I return arguments and call the plot in the original script that is plotting the function then it works. But I don't want to generate code by hand for 50 plots, I wish to call a function each time to make the scripting compact.
Is this possible?



