lsqlin with guassian basis functions

2 views (last 30 days)
Sam
Sam on 11 Aug 2011
I have been using this bit of code to fit a constrained polynomial through 0,0
x = x(:); %reshape the data into a column vector
y = y(:);
% 'C' is the Vandermonde matrix for 'x'
n = order; % Degree of polynomial to fit
V(:,n+1) = ones(length(x),1,class(x));
for j = n:-1:1
V(:,j) = x.*V(:,j+1);
end
C = V;
% 'd' is the vector of target values, 'y'.
d = y;
There are no inequality constraints in this case, i.e.,
A = [];
b = [];
x0=1;y0=1;
We use linear equality constraints to force the curve to hit the required point. In this case, 'Aeq' is the Vandermoonde matrix for 'x0'
Aeq = x0.^(n:-1:0);
% and 'beq' is the value the curve should take at that point
beq = y0;
p = lsqlin( C, d, A, b, Aeq, beq );
I wanted to change C to a Gaussian basis function. Can anyone give me a clue how?
thanks for your help I have nowhere else to turn
sam

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!