% Create tau objects.
[x, y] = tau('LegendreP', [0 1], 50);

% Translate the differential operator.
D = x*diff(y, 2)+2*diff(y)-(6*x+4*x^3)*y;
D = D.mat; T = zeros(length(D));

% Translate the conditions and allocate the truncated operator.
T(1, :) = diff(y, 0, 0); T(2, :) = diff(y, 1, 0);
T(3: x.n, 1:x.n) = D(1:x.n-2, 1:x.n);
b = zeros(x.n, 1); b(1) = 1;

% Obtain the solution.
a = T\b;

% Plot the error.
xx = linspace(x, 100);
plot(xx, abs(orthoval(x, xx, 'coef', a)-exp(xx.^2)));