Question

Check the file: Questions.pdf

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

4.

a.
function weights = barywghts(x)
    X = repmat(x(:), [1 numel(x)]);
    xi = reshape(X(~eye(size(X))),size(X,1),size(X,2)-1);
    xj = X(:,1:end-1);
    weights = 1./prod(xj - xi, 2);
end

b.
function p = baryinterp(x,f,t)
x = x(:);
t = t(:);
f = f(:);

m = numel(t);
w = barywghts(x);
p = zeros(size(t));

for i=1:m
    interpPt = t(i) == x;
    if any(interpPt)
       temp = f(interpPt);
       p(i) = temp(1);
    else
       deno = sum(w./(t(i)-x),1);
       nume = sum((w.*f)./(t(i)-x),1);
       p(i) = nume/deno;
    end
end
end...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Related Homework Solutions

Numerical Analysis
Homework Solution
$3.00
Mathematics
Numerical Analysis
Problems
Jacobi
Gauss-Seidel
Formula
Numerical Analysis Questions
Homework Solution
$60.00
Numerical Analysis
Mathematics
Computer Science
Graphs
Cost Factors
Compressive Stress
Matlab
Optimization
Documents
Cells
Equations
Functions
Variables
Tables
Numerical Analysis Questions
Homework Solution
$8.00
Numerical Analysis
Functions
Polynomials
Proofs
Theorems
Functions
Points
Symmetry
Constants
Statements
Sums
Numerical Methods
Homework Solution
$50.00
Mathematics
Numerical Methods
Matlab
Solar Radiation Data
Prediction
Wave Function
Fourier Coefficients
Triangular Wave
Real Comparisons
Imaginary Comparisons
Discrete Transformations
Statements
Variables
Loops
Get help from a qualified tutor
Live Chats