% Sample usage of the LS-SVM toolbox for modeling
%
% Here Xl and Yl are the input and output points of the learning set,
% respectively, and Xt/Yt the inputs/outputs for the test set.
%
% Unfortunately tunelssvm requires initial guesses for the parameters, but
% you can use 1 and 1 if you have no better information.

[gam sig2] = tunelssvm({Xl, Yl, 'f', 1, 1});
[alpha beta] = trainlssvm({Xl, Yl, 'f', gam, sig2});
Y = simlssvm({Xl, Yl, 'f', gam, sig2}, {alpha, beta}, Xt);

NMSE = mean((Y-Yt).^2)/var(Yt)
