To help you out with the matlab side of things, have a look at the following code and see if you can adapt it to you problem.

save this as myfoo.m

save this as another file and run it or past straight into the command window (assuming you have already changed you working directory to be the one that hold myfoo.mCode:function output = myfoo(t,f) output = sin(t/f);

Regards ElbartoCode:cla t = linspace(0,2*pi,100); hold on for f = linspace(0.1,1,3) plot(t,myfoo(t,f)) end hold off