git-svn-id: http://moon:8086/svn/matlab/trunk@157 801c6759-fa7c-4059-a304-17956f83a07c
21 lines
379 B
Matlab
Executable File
21 lines
379 B
Matlab
Executable File
function lgip(order)
|
|
|
|
Nlg = order + 1;
|
|
Npts = 100;
|
|
t = (0:Npts-1)/Npts;
|
|
xk = [0 0.5 0];
|
|
for k=1:Npts,
|
|
y(k) = 0;
|
|
for i=0:Nlg-1,
|
|
hlg = 1;
|
|
for j=0:Nlg-1,
|
|
if (i ~= j)
|
|
hlg = hlg * (Nlg/2 - 0.5 + t(k) - j)/(i-j);
|
|
end;
|
|
end;
|
|
y(k) = y(k) + xk(i+1) * hlg;
|
|
end;
|
|
end;
|
|
plot(t, y); grid;
|
|
|