All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM: To derive the fourth order approximations of a second order derivative using central differencing scheme, skewed right sided difference and skewed left sided difference with the help of taylor table method and to compare the analytical derivative with obtained values for the given function. SCHEME DERIVATIONS: CENTRAL…
Shaik Faraz
updated on 24 Aug 2022
AIM:
To derive the fourth order approximations of a second order derivative using central differencing scheme, skewed right sided difference and skewed left sided difference with the help of taylor table method and to compare the analytical derivative with obtained values for the given function.
SCHEME DERIVATIONS:
CENTRAL DIFFERENCING SCHEME:
NO OF NODES:
The number of nodes = p+q-1
Where, p is order of derivative.
q is order of approximations.
The no of nodes = 2+4-1 =>5.
DERIVATION:
To derive a fourth order approximation for the second order derivative,we start with these approximation,
taylor series derivation for the above terms,
Simillarly expand all the terms in the equation (1) and are represented in the form of table using taylor table method.
the linear equation obtained from the above table are solved using matrix inversion method,
A.X = B
X = inv(A)*B
we get the coefficients as,
a=-0.0833, b=1.3333, c=-2.5000, d=1.3333 e=-0.0833
substituting these coefficient in equation(1) we get,
SKEWED RIGHT HAND DIFFERENCE SCHEME:
NO OF NODES:
The number of nodes = p+q
Where, p is order of derivative.
q is order of approximations.
The no of nodes = 2+4 =>6.
DERIVATION:
To derive a fourth order approximation for the second order derivative,we start with these approximation,
expand all the terms in the equation (2) using taylor series expansion and are represented in the form of table using taylor table method.
the linear equation obtained from the above table are solved using matrix inversion method,
A.X = B
X = inv(A)*B
we get the coefficients as,
a=3.7500, b=-12.8333, c=17.8333, d=-13.0000 e=5.0833 g=-0.8333
substituting these coefficient in equation(2) we get,
SKEWED LEFT HAND DIFFERENCE SCHEME:
NO OF NODES:
The number of nodes = p+q
Where, p is order of derivative.
q is order of approximations.
The no of nodes = 2+4 =>6.
DERIVATION:
To derive a fourth order approximation for the second order derivative,we start with these approximation,
expand all the terms in the equation (3) using taylor series expansion and are represented in the form of table using taylor table method.
the linear equation obtained from the above table are solved using matrix inversion method,
A.X = B
X = inv(A)*B
we get the coefficients as,
a=-0.8333, b=5.0833, c=-13.0000, d=17.8333 e=-12.8333 g=3.7500
substituting these coefficient in equation(3) we get
MATLAB CODE:
MAIN CODE:
clear all
close all
clc
%value of x
x= pi/3;
%range of dx
dx= linspace(pi/4,pi/4000,20);
%for loop
for i=1:length(dx)
central_differencing(i) = fourth_order_central_differencing(x,dx(i));
right_sided_skew(i) = fourth_order_right_sided_skew(x,dx(i));
left_sided_skew(i) = fourth_order_left_sided_skew(x,dx(i));
end
%plotting
figure(1)
loglog(dx,central_differencing,'r')
hold on
loglog(dx,right_sided_skew,'g')
hold on
loglog(dx,left_sided_skew,'b')
xlabel('range of dx')
ylabel('truncation error')
title('range of dx vs error')
legend('central differencing','skewed right sided difference','skewed left sided difference','location','northwest')
FUNCTION CODE FOR CENTRAL DIFFERENCING:
function Error_central_differencing = fourth_order_central_differencing(x,dx)
% analytic function = exp(x)*cos(x)
% analytic derivative
%f''(x) = -2*exp(x)*sin(x)
analytical_derivative = -2*exp(x)*sin(x);
%numerical derivative
%central differencing
central_differencing = (((-0.0833)*((exp(x-(2*dx)))*(cos(x-(2*dx)))))+((1.3333)*((exp(x-dx))*(cos(x-dx))))-((2.5000)*((exp(x))*(cos(x))))+((1.3333)*((exp(x+dx))*(cos(x+dx))))-((0.0833)*((exp(x+(2*dx)))*(cos(x+(2*dx))))))/(dx^2);
%error
Error_central_differencing = abs(central_differencing- analytical_derivative);
end
FUNCTION CODE FOR SKEWED RIGHT SIDED DIFFERENCE:
function Error_right_sided_skew = fourth_order_right_sided_skew(x,dx)
% analytic function = exp(x)*cos(x)
% analytic derivative
%f''(x) = -2*exp(x)*sin(x)
analytical_derivative = -2*exp(x)*sin(x);
%numerical derivative
%central differencing
right_sided_skew = (((3.7500)*((exp(x))*(cos(x))))-((12.8333)*((exp(x+dx))*(cos(x+dx))))+((17.8333)*((exp(x+(2*dx)))*(cos(x+(2*dx)))))-((13.0000)*((exp(x+(3*dx)))*(cos(x+(3*dx)))))+((5.0833)*((exp(x+(4*dx)))*(cos(x+(4*dx)))))-((0.8333)*((exp(x+(5*dx)))*(cos(x+(5*dx))))))/(dx^2);
%error
Error_right_sided_skew = abs(right_sided_skew- analytical_derivative);
end
FUNCTION CODE FOR SKEWED LEFT SIDED DIFFERENCE:
function Error_left_sided_skew = fourth_order_left_sided_skew(x,dx)
% analytic function = exp(x)*cos(x)
% analytic derivative
%f''(x) = -2*exp(x)*sin(x)
analytical_derivative = -2*exp(x)*sin(x);
%numerical derivative
%central differencing
left_sided_skew = (((-0.8333)*((exp(x-(5*dx)))*(cos(x-(5*dx)))))+((5.0833)*((exp(x-(4*dx)))*(cos(x-(4*dx)))))-((13.0000)*((exp(x-(3*dx)))*(cos(x-(3*dx)))))+((17.8333)*((exp(x-(2*dx)))*(cos(x-(2*dx)))))-((12.8333)*((exp(x-dx))*(cos(x-dx))))+((3.7500)*((exp(x))*(cos(x)))))/(dx^2);
%error
Error_left_sided_skew = abs(left_sided_skew- analytical_derivative);
end
OUTPUT:
CONCLUSION:
As seen from the plot, the central differencing scheme has very less error compared to other schemes. Therefore, central differencing is better than other schemes because it uses information from both the sides from the point of consideration to give approximative and accurate values.
As the left and right skewed difference methods uses data only from one side of point of interest it gives less approximative and accurate values about the point.
WHY A SKEWED SCHEME IS USEFUL:
The system which doesn’t contain sufficient information on both side of the point of interest. In such cases we cannot use central differencing scheme so skewed scheme is useful in such cases.
WHAT CAN A SKEWED SCHEME DO THAT A CD SCHEME CANNOT DO:
CDS cannot not be employed at the boundary nodes due to unavailability of right and left nodes at the same time. In such cases the skewed differencing scheme is used.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Project 1 : CFD Meshing for Tesla Cyber Truck
Aim: Performing topological cleanup and surface mesh on tesla cyber truck and on a wind tunnel based on selected target length values of its different components using element type as Tria, as well as appropriate selection of the volume that contains the vehicle and its surroundings with the wind tunnel for volumetric…
15 Nov 2022 04:17 AM IST
Week 5 Challenge : Surface wrap on Automotive Assembly
Aim: Perforform Topo cleanup and delete unwanted surfaces for Surface wrap. After Topo cleanup, Merge all 3 models and perform surface wrap. Target length for Wrap = 3 mm 1. Engine: 2. Gear box: 3. Transmission: Procedure: 1. Topo Cleanup : (Engine, Transmission & Gear Box)…
10 Nov 2022 08:22 AM IST
Week 4 Challenge : CFD Meshing for BMW car
Aim: To perform topological clean-up, and carry out the surface meshing of a BMW M6 car model and create a wind tunnel surrounding the same. Objectives: For the given model, check and solve all geometrical errors on half portion and Assign appropriate PIDs. Perform meshing with the given Target length and element Quality…
07 Nov 2022 11:33 AM IST
Week 3 Challenge : CFD meshing on Turbocharger
Aim: Performing CFD meshing on Turbocharger using ANSA Objective: For the given model, check for the geometrical errors to make appropriate volumes. Create and assign PIDs as shown in the video. Perform surface mesh with the given target lengths as per PIDs. Blade stage-1 = 1 mm Blade stage-2 = 1 mm Impeller = 2 mm…
03 Nov 2022 08:06 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.