%% Jegyzet 258.o demo példa
x = [0 pi/4 3*pi/8 3*pi/4 pi];  % alappontok
y = sin(x);                     % függvényértékek
xi = linspace(0,pi,30);
ys = interp1(x,y,xi,'spline');
yn = interp1(x,y,xi,'nearest');
yl = interp1(x,y,xi,'linear');
xx = linspace(0,pi,50);
plot(xx,sin(xx),'-',x,y,'.','MarkerSize',20), hold on
set (gca,'XTick',x), set (gca,'XGrid','on')
set (gca,'XTickLabel','0|pi/4|3pi/8|3pi/4|pi')
h = plot(xi,ys,'x',xi,yn,'o',xi,yl,'+');
axis([-0.25 3.5 -0.1 1.1])
legend(h,'spline','nearest','linear'), hold off

input('Befejezés ENTER-rel');
close