Question

Matlab Matlab Matlab Matlab, Please solve this problemProblem 4 : Runges phenomenon For this proble, you wil interpolate the function h(x) = tanh(10x) in I [a, b, through n datap

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

close all
clear all
clc
for n=5:10:35
x=linspace(-1,1,n);
y=tanh(10*x);
C=polyfit(x,y,n-1);
subplot(2,2,0.1*n+0.5)
xx=-1:0.01:1;
yy=polyval(C,xx);
plot(xx,yy);
end

, Figure 1 File Edit View srt Iools Desktop Window Help 1.5 0.5 -0.5 1.5 -1 08 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 .2 -1 -08 0.6

Note: Brother according to HomeworkLib's policy we are only allowed to answer first part if there are many. So, I request you to post other part as separate posts.

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Matlab Matlab Matlab Matlab, Please solve this problem Problem 4 : Runge's phenomenon For this proble,...
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
  • Consider polynomial interpolation of the function f(x)=1/(1+25x^2) on the interval [-1,1] by (1) ...

    Consider polynomial interpolation of the function f(x)=1/(1+25x^2) on the interval [-1,1] by (1) an interpolating polynomial determined by m equidistant interpolation points, (2) an interpolating polynomial determined by interpolation at the m zeros of the Chebyshev polynomial T_m(x), and (3) by interpolating by cubic splines instead of by a polynomial. Estimate the approximation error by evaluation max_i |f(z_i)-p(z_i)| for many points z_i on [-1,1]. For instance, you could use 10m points z_i. The cubic spline interpolant can be determined in...

  • N MATLAB: This is an easy problem to demonstrate how polyfit and polyval work! The values...

    N MATLAB: This is an easy problem to demonstrate how polyfit and polyval work! The values in y are basically a sine function on x. You can validate by checking in MATLAB >> x = 0:9 x = 0 1 2 3 4 5 6 7 8 9 >> y = sin(x) y = 0 0.8415 0.9093 0.1411 -0.7568 -0.9589 -0.2794 0.6570 0.9894 0.4121 Now, let us try to see what happens if we use polyfit on the values of...

  • Homework 5 (35 Points max) Please Submit all Matlab and Data files that you create for this homew...

    Homework 5 (35 Points max) Please Submit all Matlab and Data files that you create for this homework Problem 1 (max 20 Points): For the second-order drag model (see Eq.(1)), compute the velocity of a free-falling parachutist using Euler's method for the case where m80 kg and cd 0.25 kg/m. Perform the calculation from t 0 to 20 s with a step size of 1ms. Use an initial condition that the parachutist has an upward velocity of 20 m/s at...

  • Please use matlab, post the code, and dont just write the code by hand. Thank you!...

    Please use matlab, post the code, and dont just write the code by hand. Thank you! 4 [3 points] Use the function f(x on the interval [5, 5] and the 11 points below to find a N-10 Lagrange polynomial, using MATLAB. You will need to write code for and plot the polynomial as a function of x, but you do not have to write the polynomials down by hand 5 0 2 3 4 5 f(x) | 0.0399 | 00623...

  • Problem 4 : Finite difference formula and interpolation For this problem, you will approximate th...

    Please answer this problem using MATLAB. Problem 4 : Finite difference formula and interpolation For this problem, you will approximate the derivative of the function g(x)5x6x 23823x 15 on a set of points using the centered difference formula (x +h) -g(x- h) 2h g'(x) Then, you will find the interpolating polynomial through these points, Q, and verify that it is indeed close to the polynomial that is the true derivative of g, ie. Q(x) g'(x) 25x 24x36x+16x+3 In your prob40...

  • Problem 4 Computer Problem: Before beginning this problem, copy the file interppoly.a ile in the ...

    I only need help with part C. Below is interppoly.m Problem 4 Computer Problem: Before beginning this problem, copy the file interppoly.a ile in the assignment folder to the directory you will be sing when you start up Matlab a): Let e, -[一6,5, Rr each degree n-4,8, 16, and 32, plt over the interval (내 the error function e(r)-f(r)-Po(x), where f(z-1/(1 +r') nd P() is the polynoenial of degree which interpolates f at the equally spaced interpolation points r +16-a),i0...

  • 1) Use the Matlab function polyfit to curve fit the saturation pressure versus temperature data a...

    MATLAB Code for question (2) 1) Use the Matlab function polyfit to curve fit the saturation pressure versus temperature data along the vaporization line for water in the table below with a polynomial of degree n. The Matlab function polyval may be used to evaluate the polynomial at any point. Compare the saturation pressure as calculated by the polynomial with the data given in the table and observe what happens as the degree of the polynomial n is increased. Tabulate...

  • A wind tunnel test conducted on an airfoil section yielded the following data between the lift...

    A wind tunnel test conducted on an airfoil section yielded the following data between the lift coefficient (CL) and the angle of attack (?): 12 1.40 16 1.71 20 1.38 de CL 0.11 0.55 0.95 You are required to develop a suitable polynomial relationship between ? and CL and fit a curve to the data points by the least-squares method using (a) hand calculations and (b) Matlab programming Hint: A quadratic equation (parabola) y(x)-aa,x +a x' can be used in...

  • Please MATLAB for all coding with good commenting. (20) Consider the function f(x) = e* -...

    Please MATLAB for all coding with good commenting. (20) Consider the function f(x) = e* - 3x. Using only and exactly the four points on the graph off with x-coordinates -1,0, 1 and 2, use MATLAB's polyfit function to determine a 3' degree polynomial that approximates f on the interval (-1, 2]. Plot the function f(x) and the 360 degree polynomial you have determined on the same set of axes. f must be blue and have a dashed line style,...

  • please provide matlab solution too 3. Butterball recommends the following cooking times for turkeys at 325...

    please provide matlab solution too 3. Butterball recommends the following cooking times for turkeys at 325 °C. size, (lbs) un-stuffed t, (h) stuffed t, (h) 2.00 2.25 6. 2.50 2.75 10 3.00 3.50 18 3.50 4.50 22 4.00 5.00 24 4.50 5.50 30 5.00 6.25 (a) Plot the recommended cooking time as a function of turkey size for un-stuffed and stuffed turkeys on the same plot. (b) For each of the two menu options, find the third-order interpolating polynomial (by...

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
ADVERTISEMENT