Question

Using the X and Y values below, write a MATLAB function SECOND_DERIV in MATLAB. The output...

Using the X and Y values below, write a MATLAB function SECOND_DERIV in MATLAB. The output of the function should be the approximate value for the second derivative of the data at x, the input variable of the function.
Use the forward difference method and interpolate to get your final answer.
X=[1,1.2,1.44,1.73,2.07,2.49,2.99,3.58,4.3,5.16,6.19,7.43,8.92,10.7,12.84,15.41,18.49];
Y=[18.89,19.25,19.83,20.71,21.96,23.6,25.56,27.52,28.67,27.2,19.38,-2.05,-50.9,-152.82,-354.73,-741.48,-1465.11];

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

function second_Derivative = SECOND_DERIV(x)
X=[1,1.2,1.44,1.73,2.07,2.49,2.99,3.58,4.3,5.16,6.19,7.43,8.92,10.7,12.84,15.41,18.49];
Y=[18.89,19.25,19.83,20.71,21.96,23.6,25.56,27.52,28.67,27.2,19.38,-2.05,-50.9,-152.82,-354.73,-741.48,-1465.11];

dydx=diff(Y)./diff(X);%first derivative using forward difference
dy2dx2=diff(dydx)./diff(X(1:end-1));%second derivative using forward difference
X=X(1:end-2);%x values coresponding to 2nd derivatives in dyy
second_Derivative= interp1(X,dy2dx2,x,'linear','extrap');%using interpolation to find the second derivation at any point
%using extrap in case input x is beyond the range of X

Add a comment
Know the answer?
Add Answer to:
Using the X and Y values below, write a MATLAB function SECOND_DERIV in MATLAB. The output...
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
  • Matlab please Using the X and Y values below, write a MATLAB function SECOND_DERIV in MATLAB....

    Matlab please Using the X and Y values below, write a MATLAB function SECOND_DERIV in MATLAB. The output of the function should be the approximate value for the second derivative of the data at x, the input variable of the function Use the forward difference method and interpolate to get your final answer. X=[1,1.2,1.44,1.73,2.07,2.49,2.99,3.58,4.3,5.16,6. 19,7.43,8.92, 10.7,12.84,15.41,18.49]; Y=[18.89,19.25,19.83,20.71,21.96,23.6,25.56,27.52,28.67,27.2,19.38,-2.05,-50.9,-152.82,-354.73,-741.48,-1465.11];

  • Using MATLAB Linear Interpolation: The following equation illustrates how to calculate an output for any input,...

    Using MATLAB Linear Interpolation: The following equation illustrates how to calculate an output for any input, using linear interpolation. The input must be within the bounds of the data set. The constants come from the data set; they are the nearest data points that bound the original input. (constants from data set--> y1, x1, y2) (output--> y) (input--> x) Create a MATLAB function file that calculates the linearly interpolated y-value (output) provided an x-value (input). The function should linearly interpolate...

  • IN MATLAB Write a MATLAB function that can be used by a user to perform polynomial...

    IN MATLAB Write a MATLAB function that can be used by a user to perform polynomial interpolation using Lagrange Interpolation Method on a set of data. You should name your function as YourInitials_Lagrange_interpolation. 1. FUNCTION INPUT: . The input data pairs x and f(x) should be expressed as vectors and are used to construct the interpolation polynomials The interpolating data points/value The order of interpolating polynomials to be used. For this project you code should handle first order, second order...

  • 5. Create a MATLAB script to find the first and second derivative of given function using Forward, Backward, central an...

    5. Create a MATLAB script to find the first and second derivative of given function using Forward, Backward, central and Taylor numerical schemes. Test your code using the following functions: f(x)-xe*+3x2 +2x -1 and find f (3) and f' (3) for with h 0.1, 0.01 and 0.001 b. Approximate y'(1) and y"(1) using the following table f(x) 0.992 0.8 0.9 0.999 1.0 1.001 1.008 Input: (copy and paste the MATLAB or Scilab script in the following box) 5. Create a...

  • MATLAB 1) Calculate the following for the function f(x) = e-4x- 2x3

    #use MATLAB script1)  Calculate the following for the function f(x) = e-4x- 2x3 a. Calculate the derivative of the function by hand. Write a MATLAB function that calculates the derivative 05. of this function and calculate the derivative at x = 0.5. b. Develop an M- to evaluate the cetered finite-difference approximation (use equation below), at x = 0.5. Assume that h = 0.1. c. Repeat part (b) for the second-order forward and backward differences. Again Assume that h = 0.1. d. Using the results...

  • Calculate the Y values corresponding to the X values given below. Find the critical values for X ...

    Calculate the Y values corresponding to the X values given below. Find the critical values for X for the given polynomial by finding the X values among those given where the first derivative, dv/dx- 0 and/orn X values where the second derivative, d-y/dx2-0. Be sure to find the sign (+ or-) of dv/dx and of d'y/dx2 at all X values. Using the first and second derivative tests with the information you have calculated, determine which X value(s) represent maximums (MAX),...

  • Please solve using MATLAB. Write a MATLAB function to compute and plot the output of the...

    Please solve using MATLAB. Write a MATLAB function to compute and plot the output of the discrete-time system for x[n]-u[n], 0 < n < 1000. Based on these results can you make a statement regarding the stability of the system? Hint: Check the value y[600]

  • Calculate the Y values corresponding to the X values given below. Find the critical values for...

    Calculate the Y values corresponding to the X values given below. Find the critical values for X for the given polynomial by finding the X values among those given where the first derivative, dv/dx- 0 and/orn X values where the second derivative, d-y/dx2-0. Be sure to find the sign (+ or-) of dv/dx and of d'y/dx2 at all X values. Using the first and second derivative tests with the information you have calculated, determine which X value(s) represent maximums (MAX),...

  • 8. Write a MATLAB function that will take as inputs a set of data (x,y) and...

    8. Write a MATLAB function that will take as inputs a set of data (x,y) and output the best estimate of the integral using a Romberg Array. The function should perform two trapezoidal integrations using the full interval and half the interval, and then combine these integrations in a Romberg Array. Your function should also output the relative error of the integral. Please note that the data entered may not be evenly spaced and your function should make sure that...

  • Write a MATLAB script file that will find the values of X and Y required to...

    Write a MATLAB script file that will find the values of X and Y required to minimize the function f(x,y) = 30x + 60y + 40pi*y subject the constraining function g(x,y) = 2xy + (pi*y^2)/2 - 1600 using the method of the Lagrange Optimization Technique.

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