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

Mathematics Questions
Homework Solution
$90.00
Mathematics
Matrices
Columns
Polynomials
Interpolation
Intervals
Points
Axes
Residuals
Computation
Matlab
Vectors
Products
Logarithms
Signs
Determinants
Numerical Analysis Questions
Homework Solution
$75.00
Mathematics
Numerical Analysis
Equations
Computation
Tables
Graphs
Vandermonde Matrix
Matlab
Hermite Interpolation
Constant Values
Coefficients
Numerical Analysis Questions
Homework Solution
$23.00
Mathematics
Numerical Analysis
Linear Systems
Matlab
Splines
Interpolation
Curves
Parameters
Points
Distances
Functions
Questions & Reports on Numerical Methods for Engineers
Homework Solution
$90.00
Advanced Mathematics
Numerical Analysis
Engineering
Computer Science
Matlab
Programming
Algorithms
Codes
Maxima
Minima
Matrix
Golden Search Method
Loop Operators
2D Direction Function
Central Difference Method
FFT
Seismic Data
Logic Opera
Numerical Approximation in Matlab
Homework Solution
$163.00
Advanced Mathematics
Numerical Analysis
Numerical Approximation
Matlab
Equation Systems
Matrices
Corresponding Force
Geometry
Tables
Values
Built-In Functions
Summation
Approximations
First Derivative
Computation
Round-Off Error
Binary Num
Differential Equation Solution Methods
Homework Solution
$35.00
Mathematics
Numerical Analysis
Differential Equations
Approximation
Trapezoid Schemes
Euler Method
Initial Value Problem
Matlab Commands
Plots
Matrices
Trigonometry
Get help from a qualified tutor
Live Chats