Take Home Final Exam (Problem 2)
Take Home Final Exam (Problem 2)
Question 2
𝜋𝑑
We want to interpolate the function 𝑓(𝑥) = 2𝑥 2 + 𝑥 − 3𝑥 3 , 0 ≤ 𝑥 ≤ 1. Take ℎ = √ with
𝛽𝑁
𝑑 = 𝜋, 𝛽 = 1.
Use Akima interpolation and Sinc interpolation for the given function for N = 10, 20, 40, 80, 160,
320, 640. Plot the graph of the function and for both Akima and Sinc for each N. You should have
seven plots. Also make an error table like Table 1 on the reference paper for both interpolations.
MATLAB Script for Sinc Interpolation
% Define the function to be interpolated
function_value = @(x) 2*x.^2 + x - 3*x.^3;
% Akima interpolation
yi = zeros(size(x_interpolation));
for j = 1:length(x_interpolation)
% Find the nearest indices in x for x_interpolation(j)
[~, idx] = min(abs(x_original - x_interpolation(j)));
xlabel('x')
ylabel('f(x)')
title(['Akima Interpolation for N = ', num2str(N)])
legend('Interpolated function', 'Original function')
end
Plot