% To load into Matlab:  just type the name of this file, without the .m
% extension.

clf;

xmin= 0;
xmax= 1;
ymin=-1;
ymax= 1;
nfine = 512;
ncoarse = 8;

%freq = 11;
freq = 9;

x=[ xmin:(xmax-xmin)/nfine:xmax];
y = sin(freq*2*pi*x);
plot(x,y);
hold on;

%freq = 3;
freq = 1;

x=[ xmin:(xmax-xmin)/nfine:xmax];
y = sin(freq*2*pi*x);
plot(x,y, ':');
hold on;

%freq = 11;
freq = 9;

x=[ xmin:(xmax-xmin)/ncoarse:xmax];
y = sin(freq*2*pi*x);
plot(x,y, 'o');
hold on;

axis([xmin xmax ymin ymax]);
h1=line([xmin xmax], [0 0]);
set(h1, 'LineStyle', '--');
h2=line([0 0], [ymin ymax]);
set(h2, 'LineStyle', '--');
ylabel('(2)');

set(gca, 'XTick', [xmin:1:xmax])
set(gca, 'YTick', [ymin:1:ymax])

set(gcf, 'PaperPositionMode', 'Manual');
set(gcf, 'PaperPosition', [0 0 7.0 3.0])
print -depsc fig_9_1

