Question
need help doing this in matlab. 1.2-1.4
Problem #1. For five data points listed in Table 1, you are asked to do the following: Write down the form of a Newtons inte
0 0
Add a comment Improve this question Transcribed image text
Answer #1

I have done hand calculation as well as matlab. I hope you find it useful.

Hand calculations:

Matlab:

x = [-0.5 0 0.5 1 1.5];
y = [0.444 1 0.444 0.167 0.082];

%part-1.2
%Finding f(x2,x3)
a1=(y(3)-y(2))/(x(3)-x(2));
%Finding f(x3,x4)
a2=(y(4)-y(3))/(x(4)-x(3));
%Finding f(x2,x3,x4)
a3=(a2-a1)/(x(4)-x(2));

fprintf('Value of f[x2,x3] : %.4f \n',a1)
fprintf('Value of f[x3,x4] : %.4f \n',a2)
fprintf('Value of f[x2,x3,x4] : %.4f \n',a3)

%part-1.3
plot(x,y)

%part-1.4
f=@(x) 0.558*x^2-1.67*x+1;
ans=f(0.4);
fprintf('\n\n f(0.4) = %.4f\n',ans)

Editor - C:\Users\SANTOSH\Documents\MATLAB\div_diff1.m* div_diff1.m* * + 1 - x = (-0.5 0 0.5 1 1.5]; 2 - y = [0.444 1 0.444 0

0.9 0.8 0.7 0.6 0.5 01 0.4 0.3 0.2 0.1 -0.5 0.5 1 1.5

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

KINDLY UPVOTE THE ANSWER IF YOU LIKED IT, IT WILL MAKE MY DAY ?

FOR ANY QUERIES COMMENT BELOW.

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

Add a comment
Know the answer?
Add Answer to:
need help doing this in matlab. 1.2-1.4 Problem #1. For five data points listed in Table...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4. For the following table, answer the questions. (1) Find the cubic Newton’s interpolating polynomial using...

    4. For the following table, answer the questions. (1) Find the cubic Newton’s interpolating polynomial using the first four data points and estimate the function value at x=2.5 with the interpolating polynomial. (2) Find the quartic Newton’s interpolating polynomial using the five data points and estimate the function value at x=2.5 with the interpolating polynomial. (3) Find the bases functions of Lagrange interpolation, Li(x) (i=1,2,…,5), and estimate the function value at x=2.5 with the Lagrange interpolating polynomial. 3 5 1...

  • 1. (25 pts) Given the following start for a Matlab function: function [answer] = NewtonForm(m,x,y,z) that inputs • number of data points m; • vectors x and y, both with m components, holding x- and y-...

    1. (25 pts) Given the following start for a Matlab function: function [answer] = NewtonForm(m,x,y,z) that inputs • number of data points m; • vectors x and y, both with m components, holding x- and y-coordinates, respectively, of data points; • location z; and uses divided difference tables and Newton form to output the value of the Lagrange polynomial, interpolating the data points, at z. 1. (25 pts) Given the following start for a Matlab function: function [answer] NewtonForm(m.x.yz) that...

  • Problem 2. Given the data points (xi. yi), with xi 2 02 4 yil 5 1 1.25 find the following interpo...

    Problem 2. Given the data points (xi. yi), with xi 2 02 4 yil 5 1 1.25 find the following interpolating polynomials, and use MATLAB to graph both the interpolating polynomials and the data points: a) The piecewise linear Lagrange interpolating polynomialx) b) The piecewise quadratic Lagrange interpolating polynomial q(x) c) Newton's divided difference interpolation pa(x) of degree s 4 Problem 2. Given the data points (xi. yi), with xi 2 02 4 yil 5 1 1.25 find the following...

  • matlab The error function is a mathematical function that frequently arises in probability and statistics. It also c...

    matlab The error function is a mathematical function that frequently arises in probability and statistics. It also can show up in the solution to some partial differential equations, particularly those arising in heat and mass transfer applications. The error function is defined as 2 e-t dt picture attached This function is actually built-in to MATLAB as the command erf, and here we'll use that function to compute a "true value" with which we can compare results of two interpolation approaches....

  • Question 3 (a) Consider the data. 00 0 25 0.5 05 () Construct the divaded difference's table for the data (u) Co...

    Question 3 (a) Consider the data. 00 0 25 0.5 05 () Construct the divaded difference's table for the data (u) Construct the Newton form of the polynomial of lowest degree that interpolates /() at these points (3) (ii) Suppose that these data were generated by the function cos 2 ()=1+ 2 Use the next term rule to approximate the error Ip(z)- f() over the interval 0,0 5 Your answer should be a pumber 3 (b) Let F ((z) co+...

  • Need Help 10) (16 points) Refer to the data table, which shows the amount of nicotine...

    Need Help 10) (16 points) Refer to the data table, which shows the amount of nicotine (mg per cigarette) in king- size cigarettes, 100mm menthol cigarettes, and 100-mm non-menthol cigarettes. The king-size cigarettes are nonfiltered, while the 100-mm menthol cigarettes and the 100-mm non-menthol cigarettes are filtered. Use a 0.05 significance level to test the claim that the three categories of cigarettes yield the same mean and amount of nicotine. (Remember to all 4 parts in a significance test) King...

  • 2. (9 points) Consider this optimizing problem and the related table of data max st. U=f(x,y)...

    2. (9 points) Consider this optimizing problem and the related table of data max st. U=f(x,y) 80 = 2x+5y 16.0 20.0 22.0 9.6 8.0 8.8 0.40 0.15 0.800.16 0.32 0.16 Explain briefly but fully why each bundle is (or is not) the optimal bundle a) (3 points) Bundle (16.0, 9.6) b) (3 points) Bundle (20.0, 8.0) c) (3 points) Bundle (22.0, 8.8) 3. (10 points) Go back to the quasi-linear utility function in Question 1 U=xy + 4y = (x+4)y...

  • Midterm Examination         CSCI 3321        Summer, 2015                     &n

    Midterm Examination         CSCI 3321        Summer, 2015                      ___________             Your Name …                 .. Please answer each question by entering the most nearly correct answer (a, b, c, d) in the blank on the left.                ____1. When approximating ex by a truncated Taylor series (expanded about x=0), how many terms would be required to keep the absolute value of the error below 10-3 over the interval [-1,1] ?                               a. 1                b. 2                c. 3                d. 4 ____2. The polynomial that...

  • MATLAB HELP I need help generating random age(x) and average systolic blood pressure(y) values or data similar to the table below in matlab. i need 75 reading or data points for both and plot of age(x...

    MATLAB HELP I need help generating random age(x) and average systolic blood pressure(y) values or data similar to the table below in matlab. i need 75 reading or data points for both and plot of age(x) against blood pressure(y). The age should be a number e.g 1, 22, 13,... and not 15 to 90, 20-24 like the chart shows for easy plotting. also the age and blood pressure show be in increasing order like the table below. Please attach matlab...

  • Exercise 6: Given the table of the function f(x)-2" 2 X 0 3 2 f(x) 1 2 4 8 a) Write down the Newton polynomial...

    Exercise 6: Given the table of the function f(x)-2" 2 X 0 3 2 f(x) 1 2 4 8 a) Write down the Newton polynomials P1(x), P2(x), Pa(x). b) Evaluate f(2.5) by using Pa(x). c) Obtain a bound for the errors E1(x), E2(x), Es(x) Exercise 7: Consider f(x)- In(x) use the following formula to answer the given questions '(x) +16-30f+16f,- 12h a) Derive the numerical differentiation formula using Taylor Series and find the truncation error b) Approximate f'(1.2) with h-0.05...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT