Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Numerical integration matlab code

The document is an assignment for a course on Numerical Methods for Chemical Engineering, focusing on flow rate calculations using Gauss Quadrature methods. It includes calculations for both 2-point and 3-point Gauss Quadrature, yielding flow rates of approximately 210.64 cm³/s and 207.89 cm³/s, respectively. Additionally, it demonstrates the use of an inbuilt function to calculate the flow rate, resulting in 205.79 cm³/s.

Uploaded by

reshmamohan.2905
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Numerical integration matlab code

The document is an assignment for a course on Numerical Methods for Chemical Engineering, focusing on flow rate calculations using Gauss Quadrature methods. It includes calculations for both 2-point and 3-point Gauss Quadrature, yielding flow rates of approximately 210.64 cm³/s and 207.89 cm³/s, respectively. Additionally, it demonstrates the use of an inbuilt function to calculate the flow rate, resulting in 205.79 cm³/s.

Uploaded by

reshmamohan.2905
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical: UMA2451– NUMERICAL METHODS FOR CHEMICAL ENGINEERING

Instructor Name : Dr. Anup Kundu

(Rename .mlx file as RNyourID)

Registration No: 3122231003043

Name of the Student: M.Reshma

LAB NO: 08

Group: B

Date: 26/02/2025

ASSIGNMENT-8

Unit-III NUMERICAL METHODS FOR CHEMICAL ENGINEERING- Application to Flow Rate Calculation
in Chemical Engineering

clc;
clear;
close all;

% Given values
%Reg.no=43
N1 = 4

N1 =
4

N2 = 3

N2 =
3

r0 = 6 * (1 + 0.01 * N1); % Pipe radius in cm


v0 = 2 * (1 + 0.01 * N2); % Velocity coefficient in cm/s

% Velocity distribution function


v = @(r) v0 * (1 - r / r0).^(1/7);
in = @(r) v(r) .* r; % Function to integrate

% 2-Point Gauss Quadrature


disp("For 2 point gauss quadrature")

For 2 point gauss quadrature

t1 = -1/sqrt(3)

1
t1 =
-0.5774

t2 = 1/sqrt(3)

t2 =
0.5774

w1 = 1

w1 =
1

w2 = 1

w2 =
1

% Transformed value and function evaluation


r1 = ((r0 *t1)+r0)/2

r1 =
1.3187

r2 = ((r0 *t2)+r0)/2

r2 =
4.9213

dt = r0 / 2

dt =
3.1200

Q_2 = (w1 * in(r1) + w2 * in(r2)) * dt * 2 * pi

Q_2 =
210.6418

% 3-Point Gauss Quadrature


disp("For 3 point gauss quadrature")

For 3 point gauss quadrature

t1 = -sqrt(3/5)

t1 =
-0.7746

t2 = 0

t2 =
0

t3 = sqrt(3/5)

t3 =
0.7746

2
w1 = 5/9

w1 =
0.5556

w2 = 8/9

w2 =
0.8889

w3 = 5/9

w3 =
0.5556

r1 = (r0 / 2) * (t1 + 1)

r1 =
0.7033

r2 = (r0 / 2) * (t2 + 1)

r2 =
3.1200

r3 = (r0 / 2) * (t3 + 1)

r3 =
5.5367

Q_3 = (w1 * in(r1) + w2 * in(r2) + w3 * in(r3)) * dt * 2 * pi

Q_3 =
207.8861

% Final Results
fprintf('Flow rate calculated using 2 point Gauss Quadrature: %.6f cm^3/
s\n', Q_2);

Flow rate calculated using 2 point Gauss Quadrature: 210.641831 cm^3/s

fprintf('Flow rate calculated using 3 point Gauss Quadrature: %.6f cm^3/


s\n', Q_3);

Flow rate calculated using 3 point Gauss Quadrature: 207.886104 cm^3/s

% using inbuilt function


in = @(r) v(r) .* r*2*pi;
fprintf("Flow rate using inbuilt function:")

Flow rate using inbuilt function:

3
quad(in,0,r0)

ans =
205.7932

You might also like