mirror of
https://bitbucket.org/Mattrixwv/octavefunctions.git
synced 2025-12-06 10:43:58 -05:00
22 lines
443 B
Matlab
22 lines
443 B
Matlab
%Test LagrangePolynomial function
|
|
|
|
close all
|
|
clear all
|
|
|
|
number_points = 10;
|
|
rng('default') %Reset the pseudo-random number generator
|
|
|
|
for(m = 2:number_points)
|
|
x_data = 10 * rand(1, m);
|
|
n = m - 1;
|
|
disp(['Degree = ' num2str(n)])
|
|
A = zeros(m);
|
|
for(k = 0:(m - 1))
|
|
A(k + 1, :) = LagrangePolynomial(x_data, k, x_data);
|
|
end
|
|
disp(A)
|
|
|
|
if(~isequal(A, eye(m)))
|
|
error('Values do not match')
|
|
end
|
|
end |