Computational Engineering-I Manual, Schemes and Mind Maps of Computational and Statistical Data Analysis

Complete lab reports of computational Engineering-I

Typology: Schemes and Mind Maps

2025/2026

Uploaded on 04/01/2026

mirza-muhammad-aslam-baig
mirza-muhammad-aslam-baig 🇵🇰

5 documents

1 / 110

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Sr
No.
Experiment
Title
1
Introduction to Python/MATLAB Programming
2 Round-off and Approximation Error
3
Root Finding for Nonlinear Equations (Bracketing
Methods)
4
Root Finding for Nonlinear Equations (Open Methods)
5 Finite Difference Techniques for Numerical
Approximations
6 Solution of Differential Equations (Runge-Kutta
Methods)
7
Numerical Evaluation of Integrals (Trapezoidal &
Simpson’s Rules)
8 Implementation of Lagrange’s Interpolation
9
Implementation of Least Square Regression
10
Numerical Approaches to Solve Elliptic PDEs
11
Numerical Approaches to Solve Parabolic PDEs
(Explicit Methods)
12
Numerical Approaches to Solve Parabolic PDEs
(Implicit Methods)
13 Solution of Linear Equations by Gauss-Seidel/Jacobi
Method
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Computational Engineering-I Manual and more Schemes and Mind Maps Computational and Statistical Data Analysis in PDF only on Docsity!

Sr No. Experiment Title 1 Introduction to Python/MATLAB Programming 2 Round-off and Approximation Error 3 Root Finding for Nonlinear Equations (Bracketing Methods) 4 Root Finding for Nonlinear Equations (Open Methods) 5 Finite Difference Techniques for Numerical Approximations 6 Solution of Differential Equations (Runge-Kutta Methods) 7 Numerical Evaluation of Integrals (Trapezoidal & Simpson’s Rules) 8 Implementation of Lagrange’s Interpolation 9 Implementation of Least Square Regression 10 Numerical Approaches to Solve Elliptic PDEs 11 Numerical Approaches to Solve Parabolic PDEs (Explicit Methods) 12 Numerical Approaches to Solve Parabolic PDEs (Implicit Methods) 13 Solution of Linear Equations by Gauss-Seidel/Jacobi Method

Implementation of Basic Matlab Programming Concepts for

Computational Engineering

Name Mirza Muhammad Aslam baig Registration No. 2022-UET-NFC-FD-MECh- 59 Session 2022 Course Code ME- 353 Course Title Computational Engineering 1 Course Instructor Engr. Khizar Siddique Section B Group B Date (^) of Submission June 18, 2025

Background:

MATLAB (short for MATrix LABoratory) is widely used in engineering for numerical computing. It supports matrix operations, algorithm development, and data visualization. Learning the basics sets the stage for applying numerical methods in later experiments.

Theory/Principles

In programming, we use:  Variables to store and manipulate data  Conditionals (if-else) for decision-making  Loops (for, while) for repetitive tasks  Functions for modular, reusable code blocks  Plotting functions for visualization of results These tools help engineers model and solve mathematical problems efficiently.

Methodology / Simulation Setup

Software Used: MATLAB R2023b

Key Tasks:

  1. Variable operations (addition, multiplication)
  2. Conditional check using if
  3. for loop from 1 to 5
  4. User-defined function for multiplication
  5. Plotting y = sin(x) using plot()

Flowchart:

Start ↓ Declare Variables ↓ Perform Arithmetic & Logical Checks ↓ Create & Use Function ↓ Use Loop to Print Values ↓ Plot Sine Wave ↓ End

Code/Algorithm (MATLAB)

% Basic MATLAB Program a = 12; b = 8; disp(['Addition: ', num2str(a

  • b)]); if a > b disp('A is greater than B'); end disp('Loop from 1 to 5:'); for i = 1: disp(i); end % User-defined multiplication function result = multiply(5, 3); disp(['Multiplication Result: ',

out = x * y; end % Plotting sin(x) x = linspace(0, 2*pi, 100); y = sin(x); plot(x, y); xlabel('x- axis'); ylabel('sin(x)'); title('Sine Wave'); grid on;

Output Results

Console Output:

Addition: 20 A is greater than B Loop from 1 to 5: 1 2 3 4 5 Multiplication Result: 15

Calculations

 Arithmetic: 12+8=2012 + 8 = 2012+8=  Multiplication (via function): 5×3=155 \times 3 = 155×3=  Sine Function: sin(x) values are calculated using MATLAB’s

built-in sin() function over a range

1

Round-off and Approximation Error in Numerical Computations

Name Mirza Muhammad Aslam baig Registration No. 2022-UET-NFC-FD-MECh- 59 Session 2022 Course Code ME- 353 Course Title Computational Engineering 1 Course Instructor Engr. Khizar Siddique Section B Group B Date (^) of Submission June 18, 2025

1

Experiment No. 2

Abstract

This experiment demonstrates the occurrence of round-off and approximation errors in numerical computation using MATLAB. Due to the finite representation of real numbers in digital systems, computations often involve small errors. We used different approximations of π and evaluated both absolute and relative errors. A log-scale plot illustrated how error decreases with increased precision. This experiment builds a foundational understanding of accuracy and error propagation in numerical methods.

Introduction

Problem Statement:

In digital computations, real numbers are stored with limited precision. This introduces round-off and approximation errors, which can accumulate in large- scale calculations.

Objective:

To calculate and analyze the absolute and relative errors caused by using different approximations of π, and visualize how precision affects numerical accuracy using MATLAB.

Background:

1

Input Values:

 True value of π: pi  Approximations: 3.1, 3.14, 3.

Steps:

  1. Calculate absolute and relative errors for each approximation
  2. Print results
  3. Plot absolute error vs number of digits (log scale)

Flowchart:

Start ↓ Define true value (π) ↓ Define approximations ↓ Compute errors (absolute & relative) ↓ Display results ↓ Plot error vs precision ↓ End

Code/Algorithm (MATLAB)

1 % Experiment 2 - Round-off and Approximation Error in MATLAB % True value of pi true_val = pi; % Approximated values of pi approximations = [3.1, 3.14, 3.1416]; % Number of significant digits in each approximation digits = [2, 4, 6]; % Calculating absolute and relative errors abs_errors = abs(true_val - approximations); rel_errors = abs((true_val - approximations) ./ true_val); % Displaying results fprintf('Approx\t\tAbsolute Error\t\tRelative Error\n'); for i = 1:length(approximations) fprintf('%.4f\t\t%.10f\t\t%.10f\n', approximations(i), abs_errors(i), rel_errors(i)); end % Plotting absolute error vs digits of precision figure; semilogy(digits, abs_errors, 'o-', 'LineWidth', 1.5, 'MarkerSize', 8); xlabel('Digits of Precision'); ylabel('Absolute Error (log scale)'); title('Absolute Error vs Number of Digits in Approximation'); grid on;

Output Results

MATLAB Console Output:

Approx Abs Error Rel Error 3.1000 0.0415926536 0. 3.1400 0.0015926536 0. 3.1416 0.0000073464 0.

Calculations

For Approximation = 3.14:

1

141592653589793 ≈0.

For Approximation = 3.1416:

𝐸𝑎𝑏𝑠 =∣3.141592653589793−3.1416∣≈7.3464× 10 −

𝐸𝑟𝑒𝑙 =7.3464×

− ≈2.338× 10 −

Discussion and Analysis

This experiment demonstrated how even small differences in number precision can lead to significant error changes. The plot confirmed that error drops exponentially as approximation improves. In numerical modeling, such small inaccuracies can propagate and compound, especially in iterative or sensitive computations.

Insights:

 Use built-in constants like pi for accurate results  Prefer higher precision approximations  Track relative error when values are large

Conclusion

The experiment successfully highlighted the presence and impact of round-off and approximation errors in MATLAB computations. By analyzing different levels of precision, we observed how errors shrink as more digits are used. This understanding is essential when implementing accurate and reliable numerical algorithms in

1 engineering simulations.

1

Experiment No. 3

Abstract

This experiment applies the Bisection Method, a fundamental bracketing technique used to find the root of nonlinear equations. MATLAB was used to implement the method for the function f(x)=𝑥^3 −x−2, which has a root between 1 and 2. The error at each iteration was recorded and plotted on a logarithmic scale. The method successfully converged to the correct root within a predefined tolerance, demonstrating its reliability and simplicity. Results are presented with MATLAB code, output, and error analysis.

Introduction

Problem Statement:

Finding roots of nonlinear equations is essential in many engineering problems. Analytical solutions are often impossible, requiring numerical methods like the Bisection Method.

Objective:

To implement the Bisection Method in MATLAB to find the root of f(x)=𝑥^3 −x−2 and analyze convergence through a plotted error graph.

Background:

Bracketing methods are simple and robust techniques for solving

2 equations of the form f(x)=0, where: