close all
clear all
n=100;
x=linspace(-9.42,9.42,n)';
xx=linspace(-9.42,9.42,n)';
xi=x;
yi=sin(x)./x;
y= sin(x)./x;
figure(1)
hold on;
plot(xx,y,'g',xx,y,'b+');
C = 10; lambda = 0.00001;
epsilon = .005;
kerneloption = 2.22;
kernel='gaussian';
verbose=1;
[xsup,ysup,w,w0] = svmreg(xi,yi,C,epsilon,kernel,kerneloption,lambda,verbose);
rx = svmval(xx,xsup,w,w0,kernel,kerneloption);
h = plot(xx,rx,'b');
set(h,'LineWidth',2);
h = plot(xsup,ysup,'or');
set(h,'LineWidth',2);
plot(xx,rx+epsilon,'b--');
plot(xx,rx-epsilon,'b--'); hold on;
title('Support Vector Machine Regression');
xlabel('x');ylabel('y');
hold off