% a simple function to display and print to file sin function print_sin() % number of sample points N=200; % limits x1=-2.5*pi; x2= 2.5*pi; x=linspace(x1,x2,N)'; % the prime makes it a column vector y=sin(x); gplot([x, y]); % print another another figure % sets the dispay to a new one %plot with lines and points gplot ([x, y]) with linespoints; hold on; % keeps the old graphics on % return to the very first figure figure (0); % plot on the same plot sin(x)/(2*x) gplot ([x, y./(x)]) with linespoints; % "./" divides % element by element hold off % now prepare to print to a file gset term post % set to postscript gset out "out.ps" replot % repeats the last plot endfunction