URGENT! It should begin with [dd,maxerr] = pa3f1() %Here is the my_divd function
ID: 3419700 • Letter: U
Question
URGENT!
It should begin with [dd,maxerr] = pa3f1()
%Here is the my_divd function..
function f = my_divdif(n,x,f)
% function f = my_divdif(n,x,f)
% Computes diagonal of divided difference table
% Inputs:
% n = order of table (needs n+1 interpolation points & values)
% x = vector of interpolation points
% f = vector of function values
for i = 1:n
for j = (n+1):-1:(i+1)
f(j) = (f(j)-f(j-1)) / (x(j)-x(j-i));
end
end
%Here is the other one needed
function p = my_interp(n,d,x,t)
% function p = my_interp(n,d,x,t)
% Computes value of interpolating polynomial at t
% Inputs:
% n = order of polynomial
% d = diagonal of divided difference table (returned by my_divdif)
% x = vector of interpolation points
% t = where we want to evaluate the interpolating polynomial
p = d(n+1);
for k = n:-1:1
p = d(k) + (t-x(k)).*p;
end
should be done with 5 equally spaced interpolation points in [0,1], and the maximum error should be computed using 101 equally spaced points in the interval [0,1].
Explanation / Answer
This is related to computer programming. please write a problem so that I can help
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.