DISCRETIZATION OF FIRST ORDER DERIVATIVE USING FIRST, SECOND AND FOURTH ORDER APPX

DESCRIPTION:

In this code, we are going to discretize the function for the first-order derivative using first, second and fourth order approximation techniques and studying the error bounced by every method by a bar chart.

CODE:

clear all
close all
clc

x = pi/3;
dx = pi/100;

%y = (sinx)/(x^3)
%actual dy by equation
dy = (x^3 *cos(x) - 3*x^2 *sin(x))/x^6;

%first order appx by frwd method
dy1 = ((sin(x+dx)/(x+dx)^3) - (sin(x)/(x)^3))/(dx);

%second order appx by central method
dy2 = ((sin(x+dx)/(x+dx)^3) - (sin(x-dx)/(x-dx)^3))/(2*dx);

%fourth order appx
dy3 = ((sin(x-(2*dx))/(x-(2*dx))^3)-(8*(sin(x-dx)/(x-dx)^3))+(8*(sin(x+dx)/(x+dx)^3))-(sin(x+(2*dx))/(x+(2*dx))^3))/(12*dx);

error1 = abs(dy1- dy);
error2 = abs(dy2- dy);
error3 = abs(dy3- dy);

error = [error1,error2,error3];
bar(error)

title('DISCRETISATION BY RANGE OF dx TERMS')
xlabel('first order error  second order error  fourth order error')
ylabel('error')



PLOT:

RESULT:

ERROR 1 = 0.0756

ERROR2 = 0.00314

ERROR3 = 1.7e-5

DETERMINATION AND STUDY OF EIGEN VALUE AND SPECTRAL RADIUS BY ITERATIVE METHODS Yokesh R · 2019-05-29 14:50:23

MAIN CODE: clear all close all clc A=[5 1 2 ; -3 9 4; 1 2 -7]; B=[10 ;-14; 33]; u = [0 1 2; 0 0 4; 0 0 0]; l = [0 0 0; -3 0 0; 1 2 0]; di = [5 0 0; 0 9 0; 0 0 -7]; mag = [0.25,0.5,0.75,1,1.5,2]; for i = 1 : length(mag) d = di*mag(i); Read more

STUDY ON BEHAVIOR OF ITERATIVE TECHNIQUES FOR TWO DIMENSIONAL CONDUCTION DISTRIBUTION Yokesh R · 2019-05-25 10:39:05

DESCRIPTION: In this code, we are going to solve the two dimesnional convection equation defining a temperture distribution. The equation can be solved by 2 methods. 1. Implicit method 2. Explicit method In explicit method, we will be solving the equation sequencial Read more

TAYLOR TABLE MODELLING FOR FOURTH-ORDER-APPROXIMATION OF SECOND ORDER DERIVATIVE Yokesh R · 2019-05-23 13:49:10

DESCRIPTION: Using the central and skewed scheme methods initially, we have to develop the Taylor table, which should be converted into a matrix and solved for the constants. These constants help in solving the second order differential equation. Finally, the error res Read more

STUDY ON 1-D CONVECTION DISTRIBUTION FOR DIFFERENT TIME-STEPS Yokesh R · 2019-05-23 06:51:17

DESCRIPTION: In this code, we are going to compare the results of the 1D convection distribution equation describing the velocity for a range of time-step values. As a result, we will be getting the plots on the final velocity profile on time marching and computational Read more

DISCRETIZATION OF A FIRST ORDER DERIVATIVE USING A RANGE OF dx TERMS Yokesh R · 2019-05-22 10:39:19

DESCRIPTION:      Here in this code, we are using a range of dx terms for discretizing the first order derivative and studying the results of the dx vs error plot  CODE: clear all close all clc x = pi/3; dx = linspace(pi/4,pi/4000,30); %y Read more

BALANCING AND STUDYING EFFECTS OF A CHEMICAL COMBUSTION EQUATION IN MATLAB Yokesh R · 2019-05-22 09:27:29

STOICHIOMETRIC COMBUSTION   DESCRIPTION:   Stoichiometric combustion defines the ideal combustion that needs to take place for a given chemical equation. This is actually the general form of equation for alkanes. The general form might differ for e Read more

STUDY ON EFFECT OF GRID POINTS IN 1D-CONVECTION DISTRIBUTION Yokesh R · 2019-05-10 07:29:29

DESCRIPTION:         In this report, we will be studying the effects of the grid points in the first order convection equation describing one dimensional velocity distribution.   frac{delu}{delt} = c*frac{delu}{delx}   CODE: cl Read more