IF YOU HAVE ANY DOUBTS COMMENT BELOW I WILL BE THERE TO HELP YOU ALL THE BEST
AS FOR GIVEN DATA...
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:
a. f(x) = xe^x +3x^2 +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)
EXPLANATION ::-
a) Matlab Code
f= @(x) x*exp(x)+3*x^2+x-1;
h = [0.1 0.01 0.001];
% for h=0.1
firstorder_forward1 = (f(3+h(1))-f(3))/h(1)
firstorder_backward1 = (f(3)-f(3-h(1)))/h(1)
firstorder_central1 = (f(3+h(1))-f(3-h(1)))/(2*h(1))
secondorder_central1 = (f(3+h(1))-2*f(3)+f(3-h(1)))/h(1)^2
% for h=0.01
firstorder_forward2 = (f(3+h(2))-f(3))/h(2)
firstorder_backward2 = (f(3)-f(3-h(2)))/h(2)
firstorder_central2 = (f(3+h(2))-f(3-h(2)))/(2*h(2))
secondorder_central2 = (f(3+h(2))-2*f(3)+f(3-h(2)))/h(2)^2
% for h=0.001
firstorder_forward3 = (f(3+h(3))-f(3))/h(3)
firstorder_backward3 = (f(3)-f(3-h(3)))/h(3)
firstorder_central3 = (f(3+h(3))-f(3-h(3)))/(2*h(3))
secondorder_central3 =
(f(3+h(3))-2*f(3)+f(3-h(3)))/h(3)^2
b) Matlab Code
x = [0.8 0.9 1.0 1.1 1.2];
f = [0.992 0.999 1.0 1.001 1.008];
firstorder_forward = (f(4)-f(3))/0.1
firstorder_backward = (f(3)-f(2))/0.1
firstorder_central = (f(4)-f(2))/0.2
secondorder_central = (f(4)-2*f(3)+f(2))/0.1^2
secondorder_higher =
(-f(1)+16*f(2)-30*f(3)+16*f(4)-f(5))/(12*0.1^2)
I HOPE YOU UNDERSSTAND..
PLS ..RATE THUMBSUP IT HELPS ME ALOT
THANKS GOODLUCK
THANK YOU....!..
5. Create a MATLAB script to find the first and second derivative of given function using Forward, Backward, central an...
specify Output, please. 6. Create a MATLAB script to integrate the given function using the numerical scheme called Trapezoid's Rule. a. f(x)- xe* +3x1+2x-1 and find for with h 0.1, 0.01 and 0.001 Input: (copy and paste the MATLAB or Scilab command in the following box)
Example 1 Find the first derivative of the function below analytically and with forward, backward and centered difference formulas at x = 0.5 and Ax=0.1. Find the true errors. f(x) = cos(3x)
Chapter 2.02: Problem #3 Using forward divided difference scheme, find the first derivative of the function f(x) - sin(2x) at - x/3 correct within 3 significant digits. Start with a step size of h 0.01 and keep halving it till you find the answer. ее NOTE #1: The above mentioned problems are taken from the book: Numerical Methods with Applications, 2nd edition, by: A. Kaw& E. E. Kalu
Estimate the second derivative of the following function using stencils for the FORWARD and CENTRAL derivatives for an order of accuracy of O(h2) for each. Use a step size of h -1. fo)x-2x2 +6 Second derivative, Forward Difference Approximation, o(h2)- Second derivative, Central Difference Approximation, O(h2) Which of the two methods is closer to the true value? (Forward/Central 12.5 points Differential Equation Estimate the second derivative of the following function using stencils for the FORWARD an derivatives for an order...
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...
answer 4, 5, 6, 7 using matlab Homework 10 1. Write the correct first-line syntax for a user defined function that is named Feynman and has input variables q and e, and outputs L and M. (Comment out of this line). 2. Using zeros, ones, and eye commands write the one line syntax to create the following matrix: 00000 01100 01010 01001 3. Write the syntax for the user defined function that calculates the surface area and volume of a...
q2 please find x1.x2.x3.x4 using matlab &73 3:45 zain JO 4ll ring Q1 a function with the name "Area Circumference" to calculate the area and circumference tput) of a rectangle. Define the inputs of this function as required. (6marks) rite a manuscript to solve the following system of equations based on [A][x] =[b)]. Find x1, x2, . (5 Marks) 2x1+ x2-3 +2x4 4 x1+5x2-3ax3 +604 -2x1 +5a2-2r3 +6x4= 4 4x1+11x2-4x3+8x4 = 5 Q3: Having f(x) = 3x6-13x2 + 2x, Integratef...
Please help me with this short, matlab/diffy q project.. teacher said it’s supposed to be a short code Matlab Project Recall that we can approximate the time derivative of a function y(t) at time tn as dt ΔΙ This follows from the limit definition of the derivative and gives the approximate slope of the function y(t) at time tn If we think about 'stepping through time from some initial time to a later time in steps of size At, then...