0% found this document useful (0 votes)
9 views61 pages

Mathematics Practicum Manual 2025

The Practicum Manual for Mathematics at Alliance University is designed to bridge theoretical knowledge and practical application for B.Tech students in CSE/IT. It focuses on numerical methods and statistical techniques, aligning with the National Education Policy 2020 to enhance employability and industry readiness. Each practicum is self-instructional, promoting independent learning and hands-on experience with key mathematical concepts relevant to engineering applications.

Uploaded by

vk883528284
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views61 pages

Mathematics Practicum Manual 2025

The Practicum Manual for Mathematics at Alliance University is designed to bridge theoretical knowledge and practical application for B.Tech students in CSE/IT. It focuses on numerical methods and statistical techniques, aligning with the National Education Policy 2020 to enhance employability and industry readiness. Each practicum is self-instructional, promoting independent learning and hands-on experience with key mathematical concepts relevant to engineering applications.

Uploaded by

vk883528284
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PRACTICUM MANUAL

for
MATHEMATICS
(Course Code: 5BS1413)

[Link]. for CSE/IT

Semester – V
2025

Course Title: Numerical Methods and Statistical


techniques

Department
of
Pure and Applied Mathematics

COLLEGE OF ENGINEERING AND DESIGN


ALLIANCE UNIVERSITY
BENGALURU

Page 1 of 61
Preface

With the rapid advancements in Industry 5.0 and the increasing expectations of industry
from academia, this practicum manual has been meticulously designed by the Pure and
Applied Mathematics Department of Alliance University. It aligns with the National
Education Policy (NEP) 2020 set forth by the Government of India to meet global standards.
The manual aims to bridge the gap between theoretical knowledge and practical application,
equipping students with the mathematical foundation essential for solving complex
engineering problems. Another aim of this practicum manual is to develop the competency
and the skills in every student as are required by the industry. Thus, it is one step forward to
make every student employable and industry ready.

One of the salient features of this Practicum Manual is that it is self-instructional. This
means that if the student knows the underpinning theory in order to perform that
concerned practicum (which s/he should have read before coming for the
lab/workshop/field), each Practicum will give the student a ‘feel’ of an ‘Operational Manual’
that he will handle in the industry where there will be nobody to instruct him/her. In other
words, each practicum is written in such a way that even without the teacher’s oral
instruction, the student will be able to perform the practicum, thereby giving him/her a ‘feel’
of the workplace/industry. The teacher’s duty is only be to oversee the work and assess the
student as s/he performs.

Multivariable calculus and differential equations play a pivotal role in various engineering
applications, including control systems, modelling, optimization, fluid dynamics, machine
learning, and structural analysis. This innovative Mathematics Practicum Manual is designed
to provide hands-on experience with key mathematical concepts and principles such as
partial derivatives, multiple integrals, vector calculus, first-order and second-order
differential equations, and their applications relevant to engineering disciplines. Each
practicum is structured with well-defined learning outcomes, fundamental theoretical
concepts, step-by-step self-instructional procedures, and guided observations to ensure
students develop industry-relevant skills and problem-solving abilities.

The faculty members of the department have designed each practicum to encourage self-
learning, fostering independent thinking and lifelong learning skills. Students are expected to
familiarize themselves with the theoretical background of each practicum including the
underpinning knowledge of that particular practicum at least a day before entering the
laboratory to maximize their learning experience.
We hope this practicum manual serves as a valuable resource, nurturing analytical thinking,
curiosity, and innovation among students at the intersection of mathematics and
engineering.

- Faculty Members, Pure and Applied Mathematics Department

Page 2 of 61
Contents

S. No. Title of the Practicum Page No.


1 Bisection Method 5
2 Newton Raphson Method 9
3 LU Decomposition Method 13
4 Gauss Seidel Method 18
5 Newton’s Forward and Backward Interpolation Method 23
6 Lagrange Interpolation formula 28
7 Newton’s Dividend Difference method 32
8 Karl Pearson’s coefficient of correlation 36
9 Spearman’s rank correlation coefficient 39
10 Method of least squares in regression analysis 42
11 Method of least squares in curve fitting techniques 45
12 Fitting a curve of the form y = ab^x or y = ax^b 49
13 Multiple correlation for 3-dimensional dataset 53
14 Partial correlation for 3-dimensional dataset 57
15 Regression surface fitting for 2-dimensional dataset 61

Page 3 of 61
List of Industry Specific Skills that will be Developed
through this Mathematics course

1. Use the computers safely (Psychomotor Domain LO).


2. Use the relevant MATLAB software to revolve required programs (Psychomotor
Domain LO).
3. Follow ethics (Affective Domain LO).
4. Follow good housekeeping (Affective Domain LO).

Page 4 of 61
Practicum No.1 Date:………….
Bisection Method

I. Practical Significance
The practical significance of applying the bisection method to find the real positive root of the
equation lies in its reliability and simplicity for solving nonlinear equations numerically. The method
guarantees convergence to a root as long as the function is continuous and the initial interval
brackets a root. In this case, it effectively narrows down the solution within a specified tolerance
(Eg.0.0001), demonstrating its utility for engineering, physics, and applied mathematics problems
where analytical solutions may be difficult or impossible to obtain. The bisection method is
particularly useful in systems modeling, structural analysis, thermodynamics, and control
engineering, offering a dependable approach for root approximation in real-world applications where
precision and robustness are critical.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of bisection method, to find approximate solutions to nonlinear equations
in engineering and scientific applications.
a) Use the computers safely (Psychomotor Domain LO).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain LO).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s) (As stated in the course structure)


CO 1. Solve algebraic, transcendental, and linear systems of equations using numerical methods..

IV. Practical Outcome (PrO) (As stated in the course structure)


PrO1 - Use MATLAB to implement the bisection method for finding the real positive root of a
nonlinear equation within a specified tolerance. (say).

V. Related ADO(s) (As stated in the course structure)


a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


The bisection method is a bracketing numerical technique used to find a real root of a continuous
function f(x) by repeatedly dividing an interval in half. It is based on the Intermediate Value Theorem,
which states that if a continuous function changes sign over an interval [a,b], then there exists at
least one real root in that interval. At each iteration, the midpoint c=(a+b)/2 is evaluated, and the
subinterval where the sign change occurs is selected for the next step. This process is continued until
the length of the interval is less than a specified tolerance, ensuring that the root is approximated to
the desired accuracy. The method is guaranteed to converge, making it highly reliable for solving
nonlinear equations where analytical methods are not feasible.

Example 1: Find the real positive root of x 3−x−2=0 by the bisection method in the interval [1, 2].

Input

1. clc;
2. clear all;
3. % Define function as an anonymous function
4. f = @(x) x^3 - x - 2;

Page 5 of 61
5. % Inputs
6. a = 1;
7. b = 2;
8. tol = 0.0001;
9. maxIter = 100;
10. % Check if the root exists in the interval
11. if f(a)*f(b) > 0
12. disp('No root found in the given interval.');
13. else
14. % Bisection iteration
15. iter = 0;
16. while (b - a)/2 > tol
17. c = (a + b)/2;
18. fc = f(c);
19. % Display iteration result
20. fprintf('Iteration %d: c = %.6f, f(c) = %.6f\n', iter, c, fc);
21. if fc == 0
22. break;
23. elseif f(a)*fc < 0
24. b = c;
25. else
26. a = c;
27. End
28. iter = iter + 1;
29. if iter > maxIter
30. disp('Maximum iterations reached.');
31. break;
32. end
33. end
34. % Final result
35. root = (a + b)/2;
36. fprintf('\nApproximate root = %.6f\n', root);
37. fprintf('f(root) = %.6f\n', f(root));
38. end
Output

Iteration 0: c = 1.500000, f(c) = -0.125000

Iteration 1: c = 1.750000, f(c) = 1.609375

Iteration 2: c = 1.625000, f(c) = 0.666016

Iteration 3: c = 1.562500, f(c) = 0.252197

Iteration 4: c = 1.531250, f(c) = 0.059113

Iteration 5: c = 1.515625, f(c) = -0.034054

Iteration 6: c = 1.523438, f(c) = 0.012250

Iteration 7: c = 1.519531, f(c) = -0.010971

Iteration 8: c = 1.521484, f(c) = 0.000622

Iteration 9: c = 1.520508, f(c) = -0.005179

Page 6 of 61
Iteration 10: c = 1.520996, f(c) = -0.002279

Iteration 11: c = 1.521240, f(c) = -0.000829

Iteration 12: c = 1.521362, f(c) = -0.000103

Approximate root = 1.521423

f(root) = 0.000259

VII. Resources Required


S. No. Name of Resource Suggested Broad Specification Quantity
1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Switch-on the computer.
2. Open the MATLAB software.
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1.
5. Find the real positive root of the nonlinear equation f ( x )=x 3− x−2=0 in the
interval [1,2] using the bisection method with a tolerance of 0.0001.
6. Type or paste the provided MATLAB code into the script editor.
7. Understand the logic and structure of the code, including function definition, interval
checking, iteration process, and convergence condition.
8. Save the file with a suitable name, e.g., bisection_method.m.
9. Click the "Run" button or press F5 to execute the program.
10. Observe the output in the Command Window, including each iteration result and the final
approximate root.
11. Analyze whether the result meets the desired accuracy and verify the correctness of the root
approximation.
12. Close the MATLAB session after saving your work.
13. Switch-off the computer.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable

XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


x 3 −9 x+1=0
a) Find the real positive root of by bisection method, given the root lies in the
interval (2, 4).

Page 7 of 61
x−cos x =0
b) Find the positive root of by bisection method.
4 3 2
x −x −2 x −6 x−4=0
c) Find the positive root of by bisection method.
3
x −4 x−9=0
d) Find the positive root of by bisection method.
e) Find the positive root of by bisection method.

XV. References/Suggestions for Further Reading


a) numerical methods with MATLAB for engineers and scientists by Steven C. Chapra,
McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).
b) Applied Numerical Analysis Using MATLAB by Laurene V. Fausett, Pearson Prentice Hall,
2008. (ISBN: 0132397285, 9780132397285).
c) [Link]
s_tid=srchtitle_support_results_1_bisection+method
XVI. Suggested Assessment Scheme
Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Practicum No.2 Date:………….


Newton-Raphson method
I. Practical Significance
The Newton-Raphson method holds significant practical value in solving nonlinear equations due to
its rapid convergence and efficiency when an initial approximation is close to the actual root. It is
widely used in engineering, physics, computer science, and applied mathematics for solving
equations that arise in modeling real-world systems, such as structural analysis, electrical circuit
design, fluid dynamics, and control systems. Unlike bracketing methods, it leverages the derivative of
the function to iteratively refine the root estimate, making it highly effective for smooth and

Page 8 of 61
differentiable functions. The method’s ability to deliver accurate solutions with fewer iterations
makes it suitable for real-time simulations, optimization problems, and complex scientific
computations. Its practical application is crucial in situations requiring both speed and precision in
root-finding, such as embedded systems, robotics, and numerical modeling in industrial applications.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of Newton-Raphson method, to find approximate solutions to nonlinear
equations in engineering and scientific applications.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO1. Solve algebraic, transcendental, and linear systems of equations using numerical methods.

IV. Practical Outcome (PrO)


PrO2 - Use MATLAB to implement the Newton-Raphson method for finding the real positive root of
a nonlinear equation within a specified tolerance. (say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


The Newton-Raphson method is an open, iterative numerical technique used to find successively
better approximations to the root of a real-valued function f(x)=0. It is derived from the first-order
Taylor series expansion and utilizes both the function value and its derivative to predict the next
estimate. This method converges quadratically, which means that once it is close to the actual root,
the number of correct digits approximately doubles with each iteration. The method is highly
efficient for smooth and differentiable functions, but it requires a good initial guess and the
derivative must not be zero at any point during iteration. It is widely used in engineering and science
applications such as thermal modeling, electrical analysis, and optimization, where fast and accurate
root-finding is essential.

x
Example 1: Find the root of the transcendental equation xe −1=0 .
Input

1. clc;
2. clear all;
3. close all;
4. % Define the function and its derivative
5. f = @(x) x*exp(x) - 1;
6. df = @(x) exp(x) + x*exp(x);
7. % Initial guess (based on rough graph or intuition)
8. x0 = 0.5;
9. % Tolerance and maximum iterations
10. tol = 1e-6;
11. max_iter = 100;
12. % Display header
13. fprintf('Newton-Raphson Method\n');

Page 9 of 61
14. fprintf('Iter\t x\t\t f(x)\n');
15. % Newton-Raphson Iteration Loop
16. for i = 1:max_iter
17. x1 = x0 - f(x0)/df(x0);
18. % Display current iteration results
19. fprintf('%d\t %.6f\t %.6f\n', i, x1, f(x1));
20. % Check for convergence
21. if abs(x1 - x0) < tol
22. fprintf('Root found at x = %.6f after %d iterations\n', x1, i);
23. break;
24. end
25. % Update for next iteration
26. x0 = x1;
27. end
28. % Check if maximum iterations reached
29. if i == max_iter
30. disp('Maximum iterations reached without convergence');
31. end
Output
Iter x f(x)

1 0.571020 0.010748
2 0.567156 0.000034
3 0.567143 0.000000
4 0.567143 0.000000

Root found at x = 0.567143 after 4 iterations

VII. Resources Required


S. No. Name of Resource Suggested Broad Specification Quantity
1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

VIII. Precautions
a) Handle the computer safely.

XVII. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Switch-on the computer.
2. Open the MATLAB software.
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1.
x
5. Interpret the given problem: Find the root of the equation f ( x )=xe −1 using the
Newton-Raphson method with an initial guess x0=0.5 and a tolerance of 10−6.
6. Type or paste the provided MATLAB code into the script editor.
7. Understand the logic and structure of the code, including function definition, interval
checking, iteration process, and convergence condition.
8. Save the file with a suitable name, e.g., NR_method.m.
9. Click the "Run" button or press F5 to execute the program.
10. Observe the output in the Command Window, including each iteration result and the final
approximate root.

Page 10 of 61
11. Analyze whether the result meets the desired accuracy and verify the correctness of the
root approximation.
12. Close the MATLAB session after saving your work.
13. Switch-off the computer.

IX. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable

X. Results (To be provided by students)

XI. Interpretation of Results (Students to provide meaning to above results)

XII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIII. Sample Practicum Related Questions


3 x−cos x−1=0
a) Find the real positive root of by Newton’s method, correct to 6
decimal places.
x−cos x =0
b) Find the positive root of by Newton-Raphson method.
3 x−cos x−1=0
c) Find the positive root of by Newton-Raphson method.
x
4 x−e =0
d) Find the positive root of by N-R method, in the interval (2,3).
cos x−xe x=0
e) Find the positive root of by by Newton-Raphson method.

XIV. References/Suggestions for Further Reading


a) Applied numerical methods with MATLAB for engineers and scientists by Steven C. Chapra,
McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).
b) Applied Numerical Analysis Using MATLAB by Laurene V. Fausett, Pearson Prentice Hall,
2008. (ISBN: 0132397285, 9780132397285).

XV. Suggested Assessment Scheme


Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

Page 11 of 61
 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Practicum No. 3 Date:………….


LU Decomposition Method
I. Practical Significance
The LU Decomposition method provides a systematic approach to solving systems of linear equations
by breaking a matrix into the product of a lower (L) and an upper (U) triangular matrix. This
technique is especially useful in solving multiple systems with the same coefficient matrix but
different right-hand side vectors, thus reducing computational effort. It is widely used in structural
engineering, circuit analysis, optimization, and numerical simulations where large systems of linear
equations frequently occur. The method is efficient, stable, and forms the basis for many numerical
algorithms in scientific computing. LU decomposition also aids in understanding matrix factorization,
which is fundamental in linear algebra and high-performance computing.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of LU Decomposition Method bisection method, to find approximate
solutions to nonlinear equations in engineering and scientific applications.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s) (As stated in the course structure)


CO 2. Solve algebraic, transcendental, and linear systems of equations using numerical methods.

IV. Practical Outcome (PrO) (As stated in the course structure)


PrO3 – Use direct methods such as Gaussian elimination and LU decomposition to solve linear
systems
relevant to engineering problems. (say).

V. Related ADO(s) (As stated in the course structure)


a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


The LU Decomposition method is a direct method used to solve systems of linear equations of the
form AX=B, where A is a square matrix. It involves factorizing matrix A into the product of two
matrices: a lower triangular matrix L and an upper triangular matrix U such that A=LUA=LU.

Page 12 of 61
In Doolittle’s method, the diagonal elements of L are set to 1, and the remaining elements are
computed by solving equations row-wise and column-wise to maintain the triangular structure. Once
the decomposition is complete, the system AX=BAX=B is solved in two steps—first,
solving LY=BLY=B using forward substitution, and then solving UX=YUX=Y using backward
substitution. LU decomposition is computationally efficient and particularly useful for solving
multiple systems with the same coefficient matrix but different right-hand side vectors.

Example 1: Using MATLAB, Find the solution of the system of equations by LU decomposition method:
2x + 3y + z = 9; 4x + 7y + 3z =21; 6x + 18y +5z = 35.
Input
1. clc;
2. clear all;
3. close all;
4. % Define A and B
5. A = [2 3 1; 4 7 3; 6 18 5];
6. B = [9; 21; 35];
7. n = length(B);
8. % Initialize L and U
9. L = eye(n); % Lower triangular with 1s on diagonal
10. U = zeros(n);
11. % Doolittle's LU decomposition
12. for i = 1:n
13. % Compute U row
14. for k = i:n
15. sum = 0;
16. for j = 1:i-1
17. sum = sum + L(i,j)*U(j,k);
18. end
19. U(i,k) = A(i,k) - sum;
20. end
21. % Compute L column
22. for k = i+1:n
23. sum = 0;
24. for j = 1:i-1
25. sum = sum + L(k,j)*U(j,i);
26. end
27. L(k,i) = (A(k,i) - sum)/U(i,i);
28. end
29. end
30. % Display L and U
31. disp('Lower triangular matrix L:');
32. disp(L);
33. disp('Upper triangular matrix U:');
34. disp(U);
35. %% Forward substitution to solve LY = B
36. Y = zeros(n,1);
37. for i = 1:n
38. sum = 0;
39. for j = 1:i-1
40. sum = sum + L(i,j)*Y(j);
41. end
42. Y(i) = B(i) - sum;
43. end

Page 13 of 61
44. disp('Intermediate vector Y (from LY=B):');
45. disp(Y);
46. %% Backward substitution to solve UX = Y
47. X = zeros(n,1);
48. for i = n:-1:1
49. sum = 0;
50. for j = i+1:n
51. sum = sum + U(i,j)*X(j);
52. end
53. X(i) = (Y(i) - sum)/U(i,i);
54. end
55. disp('Solution vector X:');
56. disp(X);
Output

Lower triangular matrix L:


1 0 0
2 1 0
3 9 1
Upper triangular matrix U:
2 3 1
0 1 1
0 0 -7
Intermediate vector Y (from LY=B):
9
3
-19
Solution vector X:
2.7143
0.2857
2.7143

VII. Resources Required


S. No. Name of Resource Suggested Broad Specification Quantity
3 Computer (intel i7 or above) 1 for each
4 MATLAB Letest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Switch on the computer and log in to your user account.
2. Launch MATLAB from the desktop or start menu.
3. Open a new script or live script to begin coding.
4. Interpret the given problem: Solve the system of equations using LU decomposition
(Doolittle’s method).
5. Enter or paste the MATLAB code defining the coefficient matrix A and right-hand side
vector B.
6. Understand the decomposition process and the use of forward and backward substitution.
7. Save the file as lu_decomposition.m.

Page 14 of 61
8. Click Run or press F5 to execute the code.
9. Check the output matrices LL, UU, intermediate vector YY, and solution vector XX.
10. Validate the solution by substituting XX back into the original equations.
11. Close MATLAB after saving your work and documenting results.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) Solve the system of equations by LU decomposition method
5 x−2 y+ z=4 ; 7 x + y−5 z=8 ; 3 x+7 y+4 z=10 .
b) Solve the system of equations by LU decomposition method
x +5 y+ z=14 ; 2 x+ y+3 z=13 ; 3 x+ y+4 z=17 .
c) Solve the system of equations by LU decomposition method
x + y + z=1 ; 4 x+3 y −z=6 ; 3 x+5 y+3 z=4 .
d) Solve the system of equations by LU decomposition method
3 x−0. 1 y−0 .2 z=7 . 85 ; 0 .1 x+7 y−0. 3 z=−19.3 ; 0 .3 x−0 .2 y+10 z=71. 4 . .
XV References/Suggestions for Further Reading
a) Applied numerical methods with MATLAB for engineers and scientists by Steven C. Chapra,
McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).
b) Applied Numerical Analysis Using MATLAB by Laurene V. Fausett, Pearson Prentice Hall,
2008. (ISBN: 0132397285, 9780132397285).
XVI Suggested Assessment Scheme
Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Member

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Page 15 of 61
Related (5) Related (5) (10)
Page 16 of 61
Practicum No. 4 Date:………….
Gauss-Seidel method
I. Practical Significance
The practical significance of employing the Gauss-Seidel iterative method to solve the given system
of equations is highly relevant across various real-world domains such as engineering, physics, and
economics, where large systems of linear equations frequently emerge. This method stands out for
its efficiency in handling sparse matrices or systems where direct methods like Gaussian elimination
become computationally intensive, making it ideal for large-scale simulations such as those in
structural analysis or electrical circuit modelling. As evidenced by the convergence in just 8 iterations
for the given system, it offers a reliable approach to approximate solutions, particularly when the
system is diagonally dominant or well-conditioned. Furthermore, its iterative refinement capability
allows for practical application in dynamic systems where exact solutions are challenging to obtain
initially, such as in iterative design processes or network optimization.
II. Competency and Practical Skills
This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of Gauss-Seidel method, to find approximate solutions to simultaneous
linear equations in engineering and scientific applications
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s) (As stated in the course structure)


CO 2. Use the principles of differential calculus to solve problems in your concerned branch of
engineering.

IV. Practical Outcome (PrO) (As stated in the course structure)


PrO4 - Generate MATLAB code to to implement the Gauss-Seidel method for finding the iterative
solution to large systems. (say).

V. Related ADO(s) (As stated in the course structure)


a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


The Gauss-Seidel method is an iterative technique used to solve a system of linear equations of the
form AX=bAX=b, where A is a square matrix, X is the vector of unknowns, and b is the right-hand side
vector. Unlike the Jacobi method, the Gauss-Seidel method uses the most recent updated values of
the unknowns as soon as they are available within the same iteration, thereby accelerating
convergence. The method is based on rearranging each equation to solve for one variable in terms of
the others and then substituting updated values progressively. Convergence is typically guaranteed if
the matrix A is strictly diagonally dominant or symmetric positive definite. The Gauss-Seidel method
is computationally efficient for large, sparse systems and forms the basis for several numerical
solvers used in engineering simulations and scientific computing.

Example 1: Use the Gauss-Seidel iterative method to solve the following system of equations:

10x + 2y +z = 9

Page 17 of 61
2x + 20y + 3z = -44

2x – 3y + 10z = 22

Conditions: Initial guess: x⁽⁰⁾ = [0, 0, 0]^T, Tolerance: 1×10⁻⁶, Max Iterations: 100

Input

1. % Coefficient matrix A and RHS vector b


2. A = [10 2 1;
3. 20 3;
4. 2 -3 10];
5. b = [9; -44; 22];
6. % Initial guess
7. x = [0; 0; 0];
8. % Parameters
9. n = length(b);
10. tol = 1e-6;
11. max_iter = 100;
12. % Iteration
13. for k = 1:max_iter
14. x_old = x;
15. for i = 1:n
16. sigma = 0;
17. for j = 1:n
18. if j ~= i
19. sigma = sigma + A(i,j) * x(j);
20. end
21. end
22. x(i) = (b(i) - sigma) / A(i,i);
23. end
24. % Convergence check
25. if norm(x - x_old, inf) < tol
26. fprintf('Converged in %d iterations\n', k);
27. break;
28. end
29. end
30. % Display result
31. disp('Solution:');
32. disp(x);

Output

Converged in 8 iterations
Solution:
1.2822
-2.5069
1.1915

VII. Resources Required


S. No. Name of Resource Suggested Broad Specification Quantity
5 Computer (intel i7 or above) 1 for each

Page 18 of 61
6 MATLAB Letest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Turn on the computer and log into your user account.
2. Launch MATLAB from the applications menu.
3. Click "New Script" or "New Live Script" to open a coding window.
4. Understand the problem: Solve the system of equations using the Gauss-Seidel method with an
initial guess of [0; 0; 0], tolerance of 10−6, and a maximum of 100 iterations.
5. Enter or paste the provided MATLAB code into the editor, defining the coefficient matrix A,
right-hand side vector b, and initial conditions.
Analyze the iterative logic, convergence check, and matrix-vector computations.
6. Save the script file as gauss_seidel_method.m.
7. Click Run or press F5 to execute the program.
8. Observe the output in the Command Window including the number of iterations and final
solution vector.
9. Interpret and validate the result by substituting it into the original equations.
10. Save your work and close MATLAB after completing the task.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) Solve the following system using the Gauss-Seidel method:
4x - y + z = 7
-2x + 6y + z = 9
x + y + 5z = -6
Conditions: Initial guess: x⁽⁰⁾ = [0, 0, 0]^T, Tolerance: 1×10⁻⁵, Max Iterations: 100

b) Apply the Gauss-Seidel method to solve:


3x + y + z = 1
x + 4y + 2z = 2
2x + y + 5z = 0
Conditions: Initial guess: x⁽⁰⁾ = [0, 0, 0]^T, Tolerance: 1×10⁻⁶, Max Iterations: 100

c) Solve the linear system using the Gauss-Seidel iterative method:


8x + 2y - z = 8
x – 5y + 3z = -4
2x + y + 7z = 10
Conditions: Initial guess: x⁽⁰⁾ = [0, 0, 0]^T, Tolerance: 1×10⁻⁶, Max Iterations: 100
XVII References/Suggestions for Further Reading

a) Online resources such as MathWorks MATLAB Central.

XVIII Suggested Assessment Scheme

Page 19 of 61
Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 20 of 61
Practicum No. 5 Date:………….
Newton’s Forward Interpolation and Newton’s backward interpolation.

I. Practical Significance
Newton’s Forward Interpolation and Newton’s Backward Interpolation are fundamental numerical
techniques used to estimate the value of a function at intermediate points between known discrete
data values. It is especially useful when data points are equally spaced, and an approximation is
required near the beginning or near the ending of the dataset. These methods are widely applied in
scientific computing, engineering analysis, and real-time sensor data estimation, where analytical
functions may not be available. The ability to interpolate data accurately helps in simulation, curve
fitting, and modeling physical systems based on experimental data. These methods strengthen
computational skills and fosters understanding of finite difference-based numerical approximations.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of multi-variable calculus and differential equations to solve various
problems with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO 2. Apply interpolation and approximation techniques to estimate unknown values from data.
IV. Practical Outcome (PrO)
PrO5 - Generate MATLAB code to implement the Newton’s Forward and Newton’s backward
interpolation methods to accurately estimate the missing values of a function from a
discrete
set of data points. (say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


Newton’s Forward Interpolation is a polynomial-based numerical technique used to estimate the
value of a function at intermediate points from a given set of equally spaced data. It is derived from
finite difference concepts and is particularly effective when the point of interpolation lies near the
beginning of the dataset.

Example 1: Use Newton’s Forward Interpolation method in MATLAB to estimate the value of a
function at a given point using the following dataset.

x f(x)

1 1

2 8

3 27

4 64

Page 21 of 61
5 125

Estimate the value of f(2.5) using Newton’s Forward Interpolation.

Input

1 clc;
2 clear;
3 % Given data
4 x = [1 2 3 4 5];
5 y = [1 8 27 64 125]; % y = x^3, just for example
6 n = length(x);
7 h = x(2) - x(1); % assuming equally spaced
8 value = 2.5; % point to interpolate
9 u = (value - x(1)) / h;
10 % Forward Difference Table
11 diff_table = zeros(n, n);
12 diff_table(:,1) = y';
13 for j = 2:n
14 for i = 1:(n-j+1)
15 diff_table(i,j) = diff_table(i+1,j-1) - diff_table(i,j-1);
16 end
17 end
18 % Display difference table
19 disp('Forward Difference Table:');
20 disp(diff_table);
21 % Newton’s Forward Interpolation Formula
22 interp = y(1);
23 u_term = 1;
24 for i = 1:n-1
25 u_term = u_term * (u - i + 1) / i;
26 interp = interp + u_term * diff_table(1, i+1);
27 end

Output
Δ0 Δ1 Δ2 Δ3 Δ4
1 7 12 6 0 0
8 19 18 6 0
27 37 24 0
64 61 0
125 0
Estimated value at x = 2.50 is 15.625000
VII. Resources Required
S. No. Name of Resource Suggested Broad Specification Quantity
1 Computer (intel i7 or above) 1 for each
2 MATLAB Letest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Self-Instructional Procedure

Page 22 of 61
Do the following steps to evolve and execute the MATLAB program:

1. Switch on the computer and launch the MATLAB software.


2. Click "New Script" or "New Live Script" to open a new file.
3. Understand the objective: Estimate f(2.5)f(2.5) using Newton’s Forward Interpolation based
on the given dataset.
4. Input the given data: x=[1 2 3 4 5], f(x)=[1 8 27 64 125].
5. Write or paste the provided MATLAB code that:
• Constructs the forward difference table
• Calculates u using u=(x−x0)/h
• Applies the Newton’s forward interpolation formula
6. Save the script as newton_forward_interp.m.
7. Run the program by clicking Run or pressing F5.
8. View the output including the forward difference table and estimated value of f(2.5).
9. Interpret the result and verify it with known values (in this case f(x)=x3).
10. Document and save your results before exiting MATLAB.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


1. Given the following dataset

x f(x)
1 2.72
1.1 3
1.2 3.32
1.3 3.67
1.4 4.06

Use Newton’s Backward Interpolation to estimate the value of f(1.25).

2. Estimate f(1.7) using Newton’s Backward Interpolation.

x f(x)
0.5 1.6487
1 2.7183

1.5 4.4817

Page 23 of 61
2 7.3891

3. Estimate f(18) using Newton’s Forward Interpolation.

x f(x)
10 100
15 225
20 400
25 625

XV. References/Suggestions for Further Reading


a) Applied numerical methods with MATLAB for engineers and scientists by Steven C. Chapra,
McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).
b) Applied Numerical Analysis Using MATLAB by Laurene V. Fausett, Pearson Prentice Hall,
2008. (ISBN: 0132397285, 9780132397285).

XVI. Suggested Assessment Scheme


Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………….

 ……………………….

 ……………………….

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 24 of 61
Practicum No. 6 Date:……….
Lagrange Interpolation formula
I. Practical Significance
Lagrange’s Interpolation is a foundational technique in numerical analysis that plays a critical role in
approximating functions from discrete data points - an essential skill in many computing and
engineering tasks. By implementing this method using MATLAB, students gain hands-on experience
in developing numerical algorithms and understanding the underlying mathematics of interpolation.
This practicum enhances their ability to reconstruct unknown functional relationships from limited or
experimental data—common in areas such as Data Science, Signal Processing, Computer Graphics,
and Scientific Computing. Interpolation is frequently used in machine learning for data preprocessing,
in computer vision for image scaling and transformation, and in software systems requiring real-time
approximation of sensor data or control parameters. The MATLAB environment facilitates rapid
prototyping, visualization, and debugging, allowing students to connect theory with computational
practice. Through this exercise, CSE/IT students strengthen their algorithmic thinking, numerical
reasoning, and proficiency in technical computing - skills that are vital for solving real-world problems
involving data reconstruction, system modelling, and simulation.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO2- Apply interpolation and approximation techniques to estimate unknown values from data.

IV. Practical Outcome (PrO)


PrO6 – Use MATLAB for applying Lagrange’s Interpolation formula to approximate the function
values from the given data points in numerical analysis (say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader

Page 25 of 61
VI. Minimum Underpinning Theory
Lagrange’s Interpolation is a fundamental concept in numerical analysis used to estimate unknown
values of a function based on known data points. It constructs an interpolating polynomial that
passes through a given set of points without requiring the computation of divided differences. The
method uses basis polynomials, each corresponding to one data point, and combines them to form a
single polynomial that approximates the function. This technique is particularly useful when
tabulated values of a function are known, but the function’s explicit formula is either unknown or
difficult to evaluate. In this practicum, MATLAB is used to implement Lagrange’s Interpolation,
enabling students to visualize and compute approximate values of the function efficiently.
Understand example 1 given below so that you will be able to perform the practicum by following
the steps in the self-instructional procedure.

Example 1: Use MATLAB to apply Lagrange’s Interpolation formula to approximate the function value
at x=2.5 using the following data:

x 1 2 3 4 5
f (x)= y 2.0 3.0 2.5 1.0 0.5

Input

32. % Given data points


33. x = [1 2 3 4 5];
34. y = [2.0 3.0 2.5 1.0 0.5];
35. % Point where interpolation is to be performed
36. xp = 2.5;
37. % Number of points
38. n = length(x);
39. % Initialize interpolated value
40. yp = 0;
41. % Apply Lagrange Interpolation
42. for i = 1:n
43. L = 1;
44. for j = 1:n
45. if j ~= i
46. L = L * (xp - x(j)) / (x(i) - x(j));
47. end
48. end
49. yp = yp + y(i) * L;
50. end
51. % Display the result
52. fprintf('The interpolated value at x = %.2f is f(%.2f) = %.4f\n', xp, xp, yp);
Output

The interpolated value at x=2.50 is f (2.50)=2.9414

VII. Resources Required


S. No. Name of Resource Suggested Broad Specification Quantity
1 Computer (intel i7 or above) 1 for each
2 MATLAB Letest version as required

VIII. Precautions
a) Handle the computer safely.

Page 26 of 61
IX. Self-Instructional Procedure
Do the following steps to compute the extreme values of a given multivariate function using
MATLAB:
1. Switch-on the computer.
2. Open the MATLAB software.
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1 as in section VI.
5. Define the given data points (x and y) in the MATLAB program as in step 1-3 of example 1.
6. Define the interpolation point (xp) in the MATLAB program as in step 4-5 of Example 1.
7. Apply the Lagrange interpolation formula using for loops to compute the interpolated value at xp
as in step 10-19 of Example 1.
8. Display the interpolated value in the MATLAB program as in step 20-21 of Example 1.
9. Interpret the algorithm developed in this MATLAB program
10. Check the obtained result with the faculty at the end of this practicum.
11. Repeat step 1 to 21 If the result is wrong ………………as seen in Example 1 in ‘ Underpinning
Theory’.
12. Save the developed MATLAB program with your name.
13. Run the saved MATLAB program codes.
14. Develop MATLAB programmes for the additional problems:
15. Using MATLAB, approximate the function for the following problems and repeat steps 1 to 21
(i) Apply Lagrange’s Interpolation formula to approximate the function value at x=3.5
using the following data:
x 2 3 4 5 6
f (x)= y 5.0 6.5 7.0 6.0 4.5
(ii) Apply Lagrange’s Interpolation formula to approximate the function value at x=1.8
using the following data:
x 1 1.5 2 2.5 3
f (x)= y 1.0 1.8 2.0 1.6 1.0
(iii) Apply Lagrange’s Interpolation formula to approximate the function value at x=7.5
using the following data:
x 5 6 7 8 9
f (x)= y 3.0 2.5 2.0 1.5 1.0
1. Close the MATLAB software.
16. Switch off the computer.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) State the effect on interpolation accuracy if the number of data points is reduced.
b) Explain how the choice of interpolation point xp (inside or outside the given data range)
affects the reliability of the interpolated result?

XV. References/Suggestions for Further Reading

Page 27 of 61
a) Applied numerical methods with MATLAB for engineers and scientists by Steven C. Chapra,
McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).

XVI. Suggested Assessment Scheme


Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 28 of 61
Practicum No.7 Date:………….

Newton’s Divided Difference method

I. Practical Significance
Newton’s Divided Difference method plays a vital role in equipping CSE and IT students with the
ability to handle interpolation over unequally spaced data - an essential task in real-world
computational applications. In fields such as data analytics, machine learning, and scientific
computing, datasets are often irregular, and accurate function approximation is required for
prediction, modelling, or optimization. Implementing this method in MATLAB enables students to
develop robust numerical algorithms capable of dealing with such complexities. Moreover, it
reinforces concepts in recursive computation, algorithmic thinking, and efficient memory use - core
areas in computer science and information technology. This practicum thus bridges theoretical
numerical analysis with practical programming skills, preparing students to tackle data-driven
challenges in industry and research.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO2. Apply interpolation and approximation techniques to estimate unknown values from data.

IV. Practical Outcome (PrO)


PrO7 - Use MATLAB for implementing Newton’s Divided Difference method for handling unequally
spaced data in interpolation techniques (say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


Interpolation is a core concept in numerical analysis that involves estimating unknown values of a
function using known data points. When the given data points are not equally spaced, Newton’s
Divided Difference method becomes a powerful tool for constructing an interpolating polynomial.
This method uses recursive computation of divided differences to create a polynomial that passes
through all the given data points. The resulting polynomial is represented in Newton’s form, which is
particularly efficient when adding new data points. Understanding the step-by-step construction of
the divided difference table and its use in formulating the interpolation polynomial is essential. The
method provides insights into numerical function approximation, which is crucial in scientific
computing, simulations, and data analysis. Understand example 1 given below so that you will be
able to perform the practicum by following the steps in the self-instructional procedure.

Page 29 of 61
Example 1:Use Newton’s Divided Difference method to interpolate the value of the function at x=8 ,
given the following unequally spaced data:
x 4 5 7 10
f (x) 19 22 38 80

Input
1. % Newton's Divided Difference Interpolation for Unequally Spaced Data
2. clc;
3. clear;
4. % Given data
5. x = [4 5 7 10];
6. y = [19 22 38 80];
7. n = length(x);
8. % Initialize divided difference table
9. div_diff = zeros(n, n);
10. div_diff(:,1) = y';
11. % Constructing the divided difference table
12. for j = 2:n
13. for i = 1:n-j+1
14. div_diff(i,j) = (div_diff(i+1,j-1) - div_diff(i,j-1)) / (x(i+j-1) - x(i));
15. end
16. end
17. % Display the divided difference table
18. disp('Divided Difference Table:');
19. disp(div_diff);
20. % Interpolation point
21. X = 8;
22. % Newton's Interpolation Formula
23. result = div_diff(1,1);
24. product_term = 1;
25. for i = 1:n-1
26. product_term = product_term * (X - x(i));
27. result = result + div_diff(1,i+1) * product_term;
28. end
29. % Display result
30. fprintf('\nInterpolated value at x = %.2f is %.4f\n', X, result);

Output

Divided Difference Table:


19.0000 3.0000 1.6667 -0.0778
22.0000 8.0000 1.2000 0
38.0000 14.0000 0 0
80.0000 0 0 0

VII. Resources Required


S. No. Name of Resource Suggested Broad Specification Quantity
1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

Page 30 of 61
VIII. Precautions
a) Handle the computer safely.

IX. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Switch-on the computer.
2. Open the MATLAB software.
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1 as in section
VI.
5. Define the given data points (x and y) in the MATLAB program as in step 4-6 of example 1.
6. Initialize the divided difference table using a zero matrix and store the initial y values in the
first column as shown in step 8–10 of example 1.
7. Construct the divided difference table using nested for loops to calculate the higher-order
differences step by step as shown in steps 12–16 of example 1.
8. Display the divided difference table using the disp() command as shown in steps 18–19 of
example 1.
9. Define the interpolation point (X) where you want to estimate the function value, as shown
in steps 20-21 of example 1.
10. Apply Newton’s Divided Difference Interpolation formula to compute the interpolated value
at point X using the formula as shown in steps 23-28 of example 1.
11. Display the final interpolated result using fprintf() as shown in steps 30 of example 1.
12. Interpret the algorithm developed in this MATLAB program
13. Check the obtained result with the faculty at the end of this practicum.
14. Repeat step 1 to 30 If the result is wrong ………………as seen in Example 1 in ‘Underpinning
Theory’.
15. Save the developed MATLAB program with your name.
16. Run the saved MATLAB program codes.
17. Develop MATLAB programmes for the additional problems:
18. Using MATLAB, interpolate the value of the function for the following problems and repeat
steps 1 to 30:
(iv) Use Newton’s Divided Difference method to interpolate the value of function at x=6 ,
given the following unequally spaced data:
x 0 3 8 15
f (x) 1 7 28 90
(v) Use Newton’s Divided Difference method to interpolate the value of function at x=7 ,
given the following unequally spaced data:
x 2 5 8 11
f (x) 4 9 20 40
(vi) Use Newton’s Divided Difference method to interpolate the value of function at x=5 ,
given the following unequally spaced data:
x 1 4 6 9
f (x) 2 8 18 50
19. Close the MATLAB software.
20. Switch off the computer

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

Page 31 of 61
XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) State the effect on the interpolated value if the interpolation point X is chosen outside the
given data range instead of within the data range.
b) Discuss how increasing the number of data points (n) affects the accuracy of interpolation.

XV. References/Suggestions for Further Reading


d) Applied numerical methods with MATLAB for engineers and scientists by Steven C. Chapra,
McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).

XVI. Suggested Assessment Scheme


Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 32 of 61
Practicum No.8 Date:………….

Karl Pearson’s Correlation Coefficient in MATLAB


I. Practical Significance
Karl Pearson’s correlation coefficient is a statistical measure used to assess the strength and direction
of the linear relationship between two variables. It plays a crucial role in data analysis, pattern
recognition, and decision-making processes across fields like Machine Learning, Data Science,
Psychology, Economics, and Engineering. Understanding this coefficient is vital in model fitting, risk
assessment, and hypothesis testing. By using MATLAB to compute it, students gain essential skills in
data preprocessing, programming logic, statistical computing, and result interpretation, all critical for
data-driven industries. This practicum enhances both analytical acumen and technical proficiency.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principles of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO4. Use the principles of ‘Correlation and Curve Fitting’ for analyzing variable relationships and
modeling trends in CSE/IT applications.

IV. Practical Outcome (PrO)


PrO8 - Use MATLAB for calculating Karl Pearson’s correlation coefficient for the given pair of
variables in statistical analysis.

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


Karl Pearson’s correlation coefficient is a widely used statistical measure that quantifies the strength
and direction of the linear relationship between two continuous variables. It is defined as the ratio of
the covariance of the two variables to the product of their standard deviations. In simple terms, it
compares how much the variables change together (covariance) relative to how much they vary
individually (standard deviation). The coefficient ranges from –1 to +1, where +1 indicates a perfect
positive linear relationship, –1 indicates a perfect negative linear relationship, and 0 indicates no
linear correlation. The formula involves calculating the difference of each data point from its mean
for both variables, multiplying these differences pairwise to find the covariance, and then dividing by
the product of the standard deviations of the two variables.

Example 1: Prepare the Statistical Analysis of Real-World Data (relationship between two variables)
using MATLAB, where the variables are given as follows:

The number of hours studied by students and their corresponding exam scores are recorded for a
class of five students. The data is as follows:
(i) Hours Studied (X): 2, 4, 6, 8, 10
(ii) Exam Scores (Y): 40, 50, 65, 80, 90

Page 33 of 61
Input
(1) % Define the data vectors
(2) X = [2, 4, 6, 8, 10]; % Hours studied
(3) Y = [40, 50, 65, 80, 90]; % Exam scores
(4) % Compute the correlation coefficient matrix
(5) r = corrcoef(X, Y);
(6) % Display the result
(7) disp('Karl Pearson Correlation Coefficient:');
(8) disp(r);
(9) % Extract the coefficient from the matrix
(10)correlation_value = r(1,2);
(11)fprintf('The correlation between study hours and exam scores is %.2f.\n', correlation_value);

Output: Karl Pearson Correlation Coefficient:


1.0000 0.9971
0.9971 1.0000
The correlation between study hours and exam scores is 1.00.

VII. Resources Required


S. No. Name of Resource Suggested Broad Specification Quantity
1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
X. Results (To be provided by students)

XI. Interpretation of Results (Students to provide meaning to above results)

XII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIII. Sample Practicum Related Questions


a)
Write the code to define the system if it involves a parameter. For example,
y +ay' +y=.
b) Identify the line of the code that needs to be changed if one wants to plot the solution from
t=0 to t=100.
XIV. References/Suggestions for Further Reading
a) Applied numerical methods with MATLAB for engineers and scientists by Steven C.
Chapra, McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2)
b) Solving Ordinary Differential Equations in MATLAB" by F. Shampine, Gladwell and S.
Thompson, Cambridge University Press, 2003. (ISBN: 978-0-07-511-07707-4).

XV. Suggested Assessment Scheme


Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %

Page 34 of 61
Performance indicators Weightage Marks Obtained
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 35 of 61
Practicum No.9 Date:………….

Spearman’s Rank Correlation Coefficient using MATLAB


I. Practical Significance
Spearman’s rank correlation coefficient is a non-parametric statistical measure used to assess the
strength and direction of the monotonic relationship between two variables. Unlike Pearson’s
correlation which requires normally distributed, interval-scaled data, Spearman’s method operates
on the ranks of the data, making it robust to outliers and suitable for ordinal data or non-linear
relationships. It finds wide application in psychology, education, health science, and other domains
where assumptions of parametric statistics do not hold. MATLAB provides computational tools to
efficiently calculate this coefficient, supporting deeper understanding of statistical dependencies
when dealing with real-world, non-normal datasets.
.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO4. Use the principles of ‘Correlation and Curve Fitting’ for analyzing variable relationships and
modeling trends in CSE/IT applications.

IV. Practical Outcome (PrO)


PrO9 - Use MATLAB for calculating Spearman’s rank correlation coefficient for the given pair of
variables in non-parametric statistics (say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


Spearman’s rank correlation coefficient is a non-parametric measure used to determine the degree
of association between two variables based on their ranks. It evaluates whether an increase in one
variable corresponds to an increase or decrease in the other, without assuming a linear or normally
distributed relationship. The coefficient ranges from –1 to +1, where +1 indicates a perfect positive
monotonic relationship, –1 indicates a perfect negative monotonic relationship, and 0 implies no
monotonic correlation. It is particularly useful when the data is ordinal or when the assumptions
required for Pearson’s correlation are not met. MATLAB facilitates the computation of Spearman’s
correlation through built-in functions, allowing efficient analysis of real-world datasets that exhibit
non-linear or ordinal behavior.
Example 1: Calculate the Spearman Rank Correlation Coefficient using MATLAB. A researcher collects
data from students on their class rank and their rank in sports performance. The data is:
(i) Academic Ranks: [1, 2, 3, 4, 5, 6]
(ii) Sports Ranks: [6, 5, 4, 3, 2, 1]
Input
(1) % Define rank vectors

Page 36 of 61
(2) academic_ranks = [1, 2, 3, 4, 5, 6];
(3) sports_ranks = [6, 5, 4, 3, 2, 1];
(4) % Calculate Spearman correlation
(5) rho = corr(academic_ranks', sports_ranks', 'Type', 'Spearman');
(6) % Display the result
(7) fprintf('Spearman Rank Correlation Coefficient: %.2f\n', rho);

Output
Spearman Rank Correlation Coefficient: -1.00

VII. Resources Required


S. No. Name of Resource Suggested Broad Specification Quantity
1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
X. Results (To be provided by students)

XI. Interpretation of Results (Students to provide meaning to above results)

XII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIII. Sample Practicum Related Questions


a) For any particular ODE, plot the solution with preferable range of x .
b) To compute a solution using method of variation of parameters, why we use this
command: syms y(t) ?

XIV. References/Suggestions for Further Reading


a) Applied numerical methods with MATLAB for engineers and scientists by Steven C.
Chapra, McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2)
b) Experiments in Microbiology, Plant Pathology and Biotechnology: K.R. Aneja, New Age
International, 2013. (ISBN: 978-9395161213)

XV. Suggested Assessment Scheme

Performance indicators Weightage Marks Obtained


1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Page 37 of 61
Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 38 of 61
Practicum No.10 Date:………….
Method of least-squares in regression analysis

I. Practical Significance
The practical significance of a straight-line fit is that it provides a simple way to model the relationship
between two variables. It helps in identifying trends, making predictions, and understanding how
changes in one variable affect another. This method is widely used in fields like economics, engineering
(Control Systems, Signal Processing, Structural Engineering, Electronics, etc) and science for data
analysis and forecasting. Its simplicity and interpretability make it a powerful tool for decision-making.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO4. Analyze relationships between variables using correlation and curve fitting techniques.

IV. Practical Outcome (PrO)


PrO10 - Use MATLAB for fitting a straight line to the given dataset using the method of least squares in
regression analysis(say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


The underlying theory of straight-line fit, also known as linear regression, is based on the assumption
that there is a linear relationship between two variables. It aims to find the best-fitting straight line
(usually using the least squares method) that minimizes the sum of the squared differences between
observed and predicted values. This method is widely used in data analysis to model trends, make
predictions, and understand relationships between variables.

Example 1: Fit a straight line y=ax+ b for the following data sets:

x 1 2 3 4 5 6 7 8 9 10
y 3.2 4.4 5.6 6.8 8 9.2 10.4 11.6 12.8 14

Input
(1) clc;
(2) clear;
(3) close all;
(4) % Create two data sets x and y
(5) x=1:10;
(6) y=3.2:1.2:14;
(7) % Calculate the coefficients using least squares

Figure 1. Output
Page 39 of 61
(8) n = length(x);
(9) % Design matrix with intercept term
(10) X = [ones(n,1), x'];
(11) % Least squares solution
(12) b = (X' * X) \ (X' * y');
(13) % Extract coefficients
(14) intercept = b(1);
(15) slope = b(2);
(16) fprintf('Fitted Line: y = %.2f + %.2fx\n', intercept, slope);
(17) figure;
(18) % Original data points
(19) scatter(x, y, 'filled'); hold on;
(20) % Fitted line
(21) plot(x, intercept + slope * x, 'r-', 'LineWidth', 2);
(22) xlabel('x'); ylabel('y');
(23) title('Least Squares Linear Fit');
(24) legend('Data Points', 'Fitted Line');

Output

The equation of the fitted straight line is y=2.10 x +3.

VII. Resources Required

S. No. Name of Resource Suggested Broad Specification Quantity


1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

VIII. Precautions
1. Handle the computer safely.

IX. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Switch-on the computer.
2. Open the MATLAB software.
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1 as in section
VI.
5. Create two data sets as in respective line nos. 5 and 6 of example 1.
6. Calculate the coefficients using least squares as in line no. 8 of example 1.
7. Design matrix with intercept term as in line no. 10 of example 1.
8. Find the Least squares solution as in line no. 12 of example 1.
9. Extract coefficients as in lines no. 14 and 15 of example 1.
10. Display the equation of the fitted line as in line no. 16 of example 1.
11. Plot fitted straight line and data points as in lines no. 19 and 21 of example 1
12. Interpret the algorithm developed in this MATLAB program developed by you.
13. Check the obtained result with the faculty at the end of this practicum.
14. Repeat steps 1 to 10, if the result is wrong ………………as seen in Example 1 in ‘ Underpinning
Theory’.
15. Save the developed MATLAB program with your name.
16. Run the saved MATLAB program codes.
17. Develop MATLAB programmes for the additional problems:

Page 40 of 61
18. Fit a straight line y=ax+ b for the following bivariate data sets in MATLAB and repeat 1 to
10:
(i) [ 1 ,2 , 3 , 4 , 5 ] , y=[ 2 , 4 , 6 , 8 ,10 ] . Also, find the Coefficient of Determination.
(ii) x=[ 0 , 1 ,2 , 3 , 4 ] , y=[ 1 ,3 ,5 , 7 , 9 ] .
(iii) x=−1 :0.5 :1 , y=[−1 , 0 ,1 , 2 ,3 ].

19. Close the MATLAB software.


20. Switch off the computer.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable

XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) For a given bivariate data set, draw a scatter diagram where not all points lie in a straight
line exactly.
b) For the above data set, find the error of the straight line fit.

XV. References/Suggestions for Further Reading


a) Applied numerical methods with MATLAB for engineers and scientists by Steven C.
Chapra, McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).
b) Applied Numerical Analysis Using MATLAB by Laurene V. Fausett, Pearson Prentice Hall,
2008. (ISBN: 0132397285, 9780132397285).

XVI. Suggested Assessment Scheme


Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Page 41 of 61
Marks Obtained Dated signature of Teacher
Process Product Total
Related (5) Related (5) (10)

Page 42 of 61
Practicum No.11 Date:………….
Method of least squares in curve fitting techniques

I. Practical Significance
A parabola fit holds practical importance as it effectively models scenarios where the rate of change
varies, such as in acceleration or cost-efficiency analyses. Its geometric properties make it invaluable
in engineering applications like bridge arches and satellite dishes. In data science, fitting a parabola
helps uncover key turning points—like maximum output or minimum expense—within a dataset. It’s
especially useful in predictive modeling when data follows a quadratic trend. Overall, parabola fitting
offers a simple yet robust method for interpreting and forecasting complex real-world behaviours.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO 4. Analyze relationships between variables using correlation and curve fitting techniques.

IV. Practical Outcome (PrO)


PrO11 - Use MATLAB for fitting a parabola to the given dataset using the method of least squares
in curve fitting techniques (say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


The underpinning theory of curve fitting involves finding a mathematical function that best describes
the relationship between a set of observed data points. It is based on minimizing the difference
between the predicted values of the function and the actual data, often using methods like least
squares.
Example 1: Fit a parabola y=a x2 +bx +c for the following data sets:

x -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2


y 8.8 6 3.8 2.2 1.2 0.8 1 1.8 3.2 5.2 7.8

Input
1. clc;
2. clear;
3. close all;
4. % Create two data sets x and y
5. x=-3:1:2;
6. y=[8.8 6 3.8 2.2 1.2 0.8 1 1.8 3.2 5.2 7.8];
7. % Fit a parabola (2nd-degree polynomial)-p(1)*x^2 + p(2)*x + p(3) using least squares
8. p = polyfit(x, y, 2);
9. % Generate fitted values

Page 43 of 61
10. x_fit = linspace(min(x), max(x), 100);
11. y_fit = polyval(p, x_fit);
12. % Plot original data and fitted curve
13. figure;
14. plot(x, y, 'r*', 'MarkerSize', 8, 'DisplayName', 'Data Points'); hold on;
15. plot(x_fit, y_fit, 'b-', 'LineWidth', 2, 'DisplayName', 'Fitted Parabola');
16. xlabel('x'); ylabel('y');
17. title('Parabolic Curve Fitting using Least Squares');
18. legend show; Figure 1. Output
19. % Display the fitted equation
20. fprintf('Fitted equation: y = %.4fx^2 + %.4fx + %.4f\n', p(1), p(2), p(3));plot(t, y(:,1), 'r',
'DisplayName', '\theta (Pitch Angle)');

Output
The equation of the fitted straight line is y=1.2 x 2+ x+1 .

VII. Resources Required

S. No. Name of Resource Suggested Broad Specification Quantity


1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Switch-on the computer.
2. Open the MATLAB software.
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1 as in section
VI.
5. Create two data sets x and y as in lines no. 5 and 6 of example 1.
6. Fit a parabola as in line no. 8 of example 1.
7. Generate fitted values as in lines no. 10 and 11 of example 1.
8. Plot original data and fitted curve as in lines no. 14 and 15 of example 1.
9. Find the fitted equation as in line no. 20 of example 1.
10. Interpret the algorithm developed in this MATLAB program developed by you.
11. Check the obtained result with the faculty at the end of this practicum.
12. Repeat step 1 to 9. If the result is wrong ………………as seen in Example 1 in ‘ Underpinning
Theory’.
13. Save the developed MATLAB program with your name.
14. Run the saved MATLAB program codes.
15. Develop MATLAB programmes for the additional problems:
16. Fit a parabola for the following data and repeat 1 to 10:
(i). Fit a parabolic curve to the trajectory of a ball thrown at an angle.
(ii). Time= [0, 1, 2, 3, 4], Height= [0, 4.9, 7.8, 8.7, 7.6].
(iii). (1, 2), (2, 5), (3, 10), (4, 17
17. Close the MATLAB software.
18. Switch off the computer.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)

Page 44 of 61
Not Applicable

XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) Model the trajectory of a projectile using a parabola fit.
b) Model the Launch and re-entry paths of spacecraft using a parabola fit.

XV. References/Suggestions for Further Reading


a) Applied numerical methods with MATLAB for engineers and scientists by Steven C.
Chapra, McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).
b) Applied Numerical Analysis Using MATLAB by Laurene V. Fausett, Pearson Prentice Hall,
2008. (ISBN: 0132397285, 9780132397285).
XVI. Suggested Assessment Scheme
Performance indicators Weightage Marks Obtained
1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 45 of 61
Practicum No.12 Date:………….
Curve Fitting

I. Practical Significance
Curve fitting using models like y=a b x (exponential regression) and y=a x b (power regression) plays
a vital role in analyzing real-world data where relationships between variables are nonlinear. These
models are particularly useful in fields such as biology, economics, and engineering, where growth,
decay, or scaling behaviors are observed. By fitting such curves to a dataset, one can uncover
underlying trends, make predictions, and evaluate system performance. In antenna design, for
instance, these regressions help model signal attenuation or gain patterns. The accuracy of the fitted
model is crucial for reliable analysis and evaluating it through metrics like R-squared or residual plots
ensures the model's validity for decision-making or further simulation.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO4. Analyze relationships between variables using correlation and curve fitting techniques.

IV. Practical Outcome (PrO)


PrO12 - Use MATLAB for fitting a curve of the form y=a b x or y=a x b to the given dataset and
analyzing model accuracy in exponential and power regression (say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


Curve fitting involves finding parameters that best align a mathematical model with observed data.
For exponential regression y=a b x, taking the logarithm transforms it into a linear
form: log y=log a+ x log b, enabling linear regression techniques. Similarly, power
regression y=a x b becomes linear via log y=log a+b log x . These transformations allow the use of
least squares estimation to determine optimal parameters. The goodness of fit is assessed using
statistical measures such as the coefficient of determination ( R ² ), which quantifies how well the
model explains the variability in the data. Understanding these transformations and evaluation
metrics is essential for accurate modelling and interpretation.

Example 1: Fit a curve of the form y=a x b to the dataset of frequency vs. signal strength and
evaluate the model accuracy using R ² .
Input
1. clc;
2. clear;
3. close all;
4. % Sample data
5. x = [1 2 3 4 5];
6. y = [2.3 4.1 5.9 8.2 10.5];

Page 46 of 61
7. % Transform to log-log space
8. logx = log(x);
9. logy = log(y);
10. % Perform linear regression on log-log data
11. p = polyfit(logx, logy, 1);
12. b = p(1);
13. loga = p(2);
14. a = exp(loga);
15. % Equation of the required exponential curve
16. y_fit = a * x.^b;
17. % Compute R-squared
18. SS_res = sum((y - y_fit).^2);
19. SS_tot = sum((y - mean(y)).^2);
20. R_squared = 1 - SS_res/SS_tot;
21. % Display results
22. fprintf('Power model: y = %.4f * x^%.4f\n', a, b);
23. fprintf('R-squared: %.4f\n', R_squared);
24. % Plot
25. figure;
26. scatter(x, y, 'filled'); hold on;
27. plot(x, y_fit, 'r-', 'LineWidth', 2);
28. xlabel('x'); ylabel('y');
29. title('Power Regression Fit');
30. legend('Data', 'Fitted Curve'); Output
31. grid on;

Output
Power model: y = 2.2185 * x^0.9379
R-squared: 0.9918.

VII. Resources Required

S. No. Name of Resource Suggested Broad Specification Quantity


1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Switch-on the computer.
2. Open the MATLAB software.
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1 as in section
VI.
5. Input the given data as in line no. 4 of example 1.
6. Transform the given data to log-log space so that the coefficients of the new linear equation
can be derived by fitting a polynomial to the data in log-log space as in line no. 7 of example
1.
7. Find the coefficient of the linear equation using polyfit as in line no. 10 of example 1.
8. Rewrite the equation in exponential form as required as in line no. 15 of example 1.
9. Compute R-squared value as in line no. 17 of example 1.

Page 47 of 61
10. Display the results as in line no. 21 of example 1.
11. Plot the given data and the fitted curve as in line no. 24 of example 1.
12. Interpret the algorithm developed in this MATLAB program developed by you.
13. Check the obtained result with the faculty at the end of this practicum.
14. Repeat step 1 to 11 If the result is wrong repeat lines 1 to 31 as seen in Example 1 in
‘Underpinning Theory’.
15. Save the developed MATLAB program with your name.
16. Run the saved MATLAB program codes.
17. Develop MATLAB programmes for the additional problems:
18. Using MATLAB fit an exponential or a power curve for the given data in MATLAB and repeat
1 to 11:
(i). Fit an exponential curve of the form y=a e bx to the dataset of time (in hours) vs.
bacterial population and evaluate the model accuracy using R ² .
Time (in hours) 0 1 2 3 4
Population 100 18 320 58 1050
0 0
b
(ii). Fit a power curve of the form y=a x to the dataset of distance (in meters) vs. signal
strength (in dB) and evaluate the model accuracy using R ² .
Distance (in meters) 1 2 4 8 16
Signal (in dB) 90 70 50 35 25
(iii). Fit an exponential curve of the form y=a b x to the dataset of year vs. investment
value (in ₹) and evaluate the model accuracy using R ² .
Year 0 1 2 3 4
Investment value (in ₹) 10000 12000 14400 17280 20736

19. Close the MATLAB software.


20. Switch off the computer.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable

XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) What should be changed in the program code if one wants to display the R-squared
value with six accurate decimal places?
b) State the use and syntax of polyfit in MATLAB?

XV. References/Suggestions for Further Reading


a) Applied numerical methods with MATLAB for engineers and scientists by Steven C.
Chapra, McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).
b) MATLAB : An Introduction with Applications by Amos Gilat, New Delhi: Wiley India,
2004. (ISBN: 9788126513949).

XVI. Suggested Assessment Scheme


Performance indicators Weightage Marks Obtained
9 Clear understanding of Problem and 10%

Page 48 of 61
Performance indicators Weightage Marks Obtained
Algorithm/Flowchart/Pseudocode
10 Implementation using MATLAB (with appropriate 30 %
functions)
11 Structured Coding and Workflow Execution 10 %
12 Expected Result 20 %
13 Findings from the Results 5%
14 Viva-voce 10 %
15 Challenging in Hackerank / Leetcode 05 %
16 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 49 of 61
Practicum No.13 Date:………….

Multiple Correlation in Multivariate Statistics

I. Practical Significance
Multiple correlation analysis is a key technique in multivariate statistics used to measure the strength
of the relationship between one dependent variable and two or more independent variables. This is
especially useful in fields like economics, psychology, and engineering, where outcomes are
influenced by multiple factors. For example, in signal processing or sensor fusion, understanding how
multiple inputs jointly affect an output can guide system design and optimization. Multiple
correlation helps quantify how well a set of predictors explains the variability in the response
variable, supporting better modeling and forecasting.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of the
industry-specific competency
 Use the principle of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering (As stated in the course structure).
a) Use the computers safely (Psychomotor Domain LO).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain LO).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s) (As stated in the course structure)


CO5. Develop regression models to evaluate multivariate relationships and predictive insights.

IV. Practical Outcome (PrO) (As stated in the course structure)


PrO13 - Use MATLAB for calculating partial correlation from the given 3-dimensional dataset to
assess variable relationships in statistical modeling(say).

V. Related ADO(s) (As stated in the course structure)


a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


In multivariate statistics, the multiple correlation coefficient R measures the strength of the
linear relationship between a dependent variable and a set of two or more independent
variables. For a 3-dimensional dataset involving one dependent variable z and two
independent variables x and x , R can be computed directly from the pairwise correlation
coefficients using the formula:

R x , yz =
√ r 2xy +r 2xz−2r xy r xz r yz
1−r 2yz
.

This expression is derived from the geometry of vector projections in standardized


multivariate space, where each variable has zero mean and unit variance. The numerator
captures the combined influence of the predictors on the response, adjusted for their inter-
correlation, while the denominator accounts for redundancy between the predictors. This
formulation provides a mathematically elegant and computationally efficient way to quantify
the strength of multivariate relationships.

Page 50 of 61
Example 1: From a sample dataset, compute the multiple correlation coefficient R between energy
consumption and the other two variables (temperature and humidity).

Input
1. clc;
2. clear;
3. close all;
4. % Sample data: Temperature (Celsius), Humidity (%), Energy Consumption (kWh)
5. data = [22 60 200;
6. 25 65 220;
7. 28 70 250;
8. 30 75 270;
9. 32 80 300];
10. % Extract variables
11. t = data(:,1); % Independent variable: Temperature
12. h = data(:,2); % Independent variable: Humidity
13. e = data(:,3); % Dependent variable: Energy Consumption
14. % Compute correlation coefficients
15. r_et = corr(e, t); % Correlation between energy and temperature
16. r_eh = corr(e, h); % Correlation between energy and humidity
17. r_th = corr(t, h); % Correlation between temperature and humidity
18. % Apply the correlation-based formula for R²
19. R_squared = (r_et^2 + r_eh^2 - 2 * r_et * r_eh * r_th) / (1 - r_th^2);
20. % Compute multiple correlation coefficient R
21. R = sqrt(R_squared);
22. % Display result
23. disp(['Multiple correlation coefficient R = ', num2str(R)]);

VII. Resources Required

S. No. Name of Resource Suggested Broad Specification Quantity


7 Computer (intel i7 or above) 1 for each
8 MATLAB Latest version as required

VIII. Precautions
b) Handle the computer safely.

IX. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Switch-on the computer.
2. Open the MATLAB software.
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1 as in
section VI.
5. Input the sample data as in line no. 4 of example 1.
6. Extract the dependent and independent variables from the data as in line no. 10 of
example 1.
7. Compute the correlations for every pair of quantities as in line no. 14 of example 1.
8. Compute the value of R−¿squared as in line no. 18 of example 1.
9. Obtain the multiple correlation coefficient R as in line no. 20 of example 1.
10. Display the result as in line no. 23 of example 1.
11. Interpret the algorithm developed in this MATLAB program developed by you.
12. Check the obtained result with the faculty at the end of this practicum.

Page 51 of 61
13. Repeat step 1 to 10 If the result is wrong repeat lines 1 to 23 as seen in Example 1 in
‘Underpinning Theory’.
14. Save the developed MATLAB program with your name.
15. Run the saved MATLAB program codes.
16. Develop MATLAB programmes for the additional problems:
17. Using MATLAB compute the multiple correlation coefficient for the following problems and
repeat 1 to 10:
(i). Given the following dataset of study hours, sleep hours, and exam scores,
compute the multiple correlation coefficient between exam scores and the other
two variables.
Study Sleep Hours Exam Score
Hours
2 8 60
4 7 70
6 6 80
8 5 90
10 4 95
(ii). Generate a random dataset of 100 observations for advertising spend (₹), social
media engagement, and sales (₹). Then compute the multiple correlation
coefficient between sales and the other two variables.
(iii). Simulate a dataset with 50 observations for temperature (°C), pressure (Pa), and
sensor output (mV). Compute the multiple correlation coefficient between sensor
output and the other two variables.
18. Close the MATLAB software.
19. Switch off the computer.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)

Not Applicable
XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken by student based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) State the effect if “data(:,1)” is replaced by “data(1,:)”.
b) Format the code to display the same output using “fprintf()” instead of “disp”.

XV. References/Suggestions for Further Reading


a) Applied numerical methods with MATLAB for engineers and scientists by Steven C.
Chapra, McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).
b) MATLAB: An Introduction with Applications by Amos Gilat, New Delhi: Wiley India, 2004.
(ISBN: 9788126513949).

XVI. Suggested Assessment Scheme (The performance indicators and their weightages will differ
from practicum-to-practicum)
The performance indicators given serves as a guideline for assessment regarding the ‘process-related
skills/LOs’ (marks to be awarded in real-time in the laboratory by the faculty member, as these
cannot be measured after practicum is over) and ‘product-related skills/LOs’.

Page 52 of 61
Performance indicators Weightage Marks Obtained
17 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
18 Implementation using MATLAB (with appropriate 30 %
functions)
19 Structured Coding and Workflow Execution 10 %
20 Expected Result 20 %
21 Findings from the Results 5%
22 Viva-voce 10 %
23 Challenging in Hackerank / Leetcode 05 %
24 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 53 of 61
Practicum No.14 Date:………….
Partial Correlation Coefficient

I. Practical Significance
In engineering, partial correlation analysis is a vital tool for identifying direct relationships between
system variables while accounting for the influence of other factors. This is particularly useful in
multivariate modelling where the goal is to isolate the direct relationship between variables. It is
widely used in domains such as signal processing, control systems, and structural engineering. For
instance, in signal processing, partial correlation helps isolate the effect of one signal on another
while filtering out noise or interference from other signals. In control systems, it aids in
understanding how a specific input affects system output independently of other inputs. In structural
engineering, it can reveal the direct impact of a design parameter (e.g., material strength) on
structural performance while controlling for environmental conditions like temperature or load.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of
industry-specific competencies.
 Use the principle of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO5. Develop regression models to evaluate multivariate relationships and predictive insights.

IV. Practical Outcome (PrO)


PrO14 - Use MATLAB for calculating partial correlation from the given 3-dimensional dataset to
assess variable relationships in statistical modeling(say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


Partial correlation quantifies the linear relationship between two variables while removing the effect
of a third variable. Given three variables x , y , and z , the partial correlation between x and y
controlling for z is computed using the formula:
r xy −r xz r yz
r xy , z= where r xy, r xz, and r yz are the pairwise correlation coefficients. This
√ (1−r 2
xz ) ⋅(1−r 2yz )
formula adjusts the correlation between x and y by accounting for the shared influence of z . It is
particularly useful in multivariate analysis where understanding the net association between
variables is critical.

Example 1: From a sample dataset, compute the partial correlation between temperature and
energy consumption controlling for humidity using MATLAB.

[temperature, humidity, energy consumption] = [22 60 200; 25 65 220; 28 70 250; 30 75 270; 32 80


300];

Input

Page 54 of 61
1. clc;
2. clear;
3. close all;
4. % Sample data: Temperature (Celsius), Humidity (%), Energy Consumption (kWh)
5. data = [22 60 200;
6. 25 65 220;
7. 28 70 250;
8. 30 75 270;
9. 32 80 300];
10. % Extract variables
11. t = data(:,1); % Temperature
12. h = data(:,2); % Humidity
13. e = data(:,3); % Energy Consumption
14. % Compute correlation coefficients
15. r_et = corr(e, t); % Correlation between energy and temperature
16. r_eh = corr(e, h); % Correlation between energy and humidity
17. r_th = corr(t, h); % Correlation between temperature and humidity
18. % Compute partial correlation between temperature and energy controlling for humidity
19. r_partial = (r_et - r_th * r_eh) / sqrt((1 - r_th^2) * (1 - r_eh^2));
20. fprintf('The partial correlation coefficient is r = %.4f\n', r_partial);

Output
The partial correlation coefficient is r = -0.2182

VII. Resources Required

S. No. Name of Resource Suggested Broad Specification Quantity


1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Self-instructional Procedure


Do the following steps to evolve and execute the MATLAB program:
1. Switch-on the computer.
2. Open the MATLAB software.
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1 as in section
VI.
5. Input the sample data as in line no. 4 of example 1.
6. Extract the dependent and independent variables from the data as in line no. 10 of example
1.
7. Compute the correlations for every pair of quantities as in line no. 14 of example 1.
8. Compute the value of the partial correlation as in line no. 18 of example 1.
9. Display the result as in line no. 20 of example 1.
10. Interpret the algorithm developed in this MATLAB program developed by you.
11. Check the obtained result with the faculty at the end of this practicum.
12. Repeat step 1 to 9 If the result is wrong repeat lines 1 to 20 as seen in Example 1 in
‘Underpinning Theory’.
13. Save the developed MATLAB program with your name.
14. Run the saved MATLAB program codes.
15. Develop MATLAB programmes for the additional problems:

Page 55 of 61
16. Using MATLAB compute the multiple correlation coefficient for the following problems and
repeat 1 to 9:
(i) Given a dataset of age, exercise hours, and blood pressure, compute the partial
correlation between age and blood pressure controlling for exercise hours.
Age (years) Exercise Hours (per week) Blood Pressure (mmHg)
25 3 120
32 5 115
45 2 130
51 4 128
60 1 140
(ii) Generate a random dataset of 50 observations for study hours, sleep hours, and
exam scores. Compute the partial correlation between study hours and exam
scores controlling for sleep hours.
(iii) Simulate a dataset of temperature, pressure, and sensor output, calculate the
partial
correlation between temperature and sensor output controlling for pressure.
17. Close the MATLAB software.
18. Switch off the computer.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable

XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) How would you modify the code to compute the partial correlation between humidity and
energy consumption controlling for temperature?
b) In line 5 to 9, the matrix data is defined. How would you access the third row of this
matrix using MATLAB syntax?
XV. References/Suggestions for Further Reading
a) Applied numerical methods with MATLAB for engineers and scientists by Steven C.
Chapra, McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).
b) MATLAB : An Introduction with Applications by Amos Gilat, New Delhi: Wiley India,
2004. (ISBN: 9788126513949).
XVI. Suggested Assessment Scheme (The performance indicators and their weightages will differ
from practicum-to-practicum)
The performance indicators given serves as a guideline for assessment regarding the ‘process-
related skills/LOs’ (marks to be awarded in real-time in the laboratory by the faculty member,
as these cannot be measured after practicum is over) and ‘product-related skills/LOs’.

Performance indicators Weightage Marks Obtained


1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %

Page 56 of 61
Performance indicators Weightage Marks Obtained
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 57 of 61
Practicum No. 15 Date:………….
Regression Surface Fitting
I. Practical Significance
Regression surface fitting is a powerful technique used to model the relationship between a
dependent variable and two or more independent variables. In multivariable regression modelling, it
helps visualize and quantify how changes in multiple inputs affect an output. This is widely used in
engineering design, economics, and data science for predictive modelling and optimization. For
example, in thermal systems, surface fitting can model how temperature varies with pressure and
volume. MATLAB provides tools to fit regression surfaces to 2D datasets, enabling accurate analysis
and decision-making.

II. Competency and Practical Skills


This practicum is expected to develop the following skills/outcomes towards the development of
the industry-specific competencies
 Use the principle of numerical methods and statistical techniques to solve various problems
with respect to concerned field of engineering.
a) Use the computers safely (Psychomotor Domain Outcome).
b) Use the relevant MATLAB software to revolve required programs (Psychomotor Domain
Outcome).
c) Adhere to laboratory safety protocols (Affective Domain LO).

III. Related CO(s)


CO5. Develop regression models to evaluate multivariate relationships and predictive insights.

IV. Practical Outcome (PrO)


PrO15 - Use MATLAB for performing regression surface fitting to the given 2-dimensional dataset for
multivariable regression modeling(say).

V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.

VI. Minimum Underpinning Theory


Regression surface fitting is a technique used to model the relationship between a dependent
variable and two independent variables in a 2D dataset. A commonly used model is the second-order
polynomial regression surface, expressed as z=a₀+ a₁ x +a ₂ y+ a ₃ x ²+ a₄ y ²+ a₅ xy , where z is
the dependent variable, x and y are the independent variables, and a ₀ through a ₅ are the
regression coefficients. Each term in the equation represents specific effects: a ₀ is the constant
offset, a ₁ x and a ₂ y are linear effects, a ₃ x ² and a ₄ y ² are quadratic effects, and a ₅ xy captures
the interaction between x and y . These coefficients are estimated using curve fitting techniques such
as least squares, which minimize the difference between observed and predicted values. This model
is particularly useful in multivariable regression modelling, enabling visualization and prediction of
outcomes based on multiple inputs.

Example 1: Fit a regression surface to model temperature (°C) based on pressure (kPa) and volume
(L) using MATLAB. Use the following dataset:

Pressure (kPa): [100, 110, 120, 130, 140]


Volume (L): [1.0, 1.2, 1.4, 1.6, 1.8]
Temperature (°C): [20, 25, 30, 35, 40]

Apply second-order polynomial regression and display the fitted equation and surface plot.

Input

Page 58 of 61
1. clc;
2. clear;
3. close all;
4. % Sample data
5. p = [100, 110, 120, 130, 140]’; % Pressure
6. v = [1.0, 1.2, 1.4, 1.6, 1.8]’; % Volume
7. t = [20, 25, 30, 35, 40]’; % Temperature
8. % Create matrix for second-order polynomial
9. X = [ones(size(p)), p, v, p.^2, v.^2, p.*v];
10. % Perform regression to calculate coefficients
11. coeffs = X \ t;
12. % Display fitted equation
13. fprintf('Fitted model is given by\n');
14. fprintf('t =%.4f+(%.4f)*p+(%.4f)*v+(%.4f)*p^2+(%.4f)*v^2+(%.4f)*p*v\n',coeffs);
15. % Generate grid for surface plot
16. [P, V] = meshgrid(100:1:140, 1.0:0.05:1.8);
17. T = coeffs(1) + coeffs(2)*P + coeffs(3)*V + coeffs(4)*P.^2 + coeffs(5)*V.^2 + coeffs(6)*P.*V;
18. % Plot the regression surface
19. figure;
20. surf(P, V, T);
21. xlabel('Pressure (kPa)');
22. ylabel('Volume (L)');
23. zlabel('Temperature (°C)');
24. title('Regression Surface Fit');

Output
Fitted model is given by
t =67.3143+(-1.3371)*p+(0.0000)*v+(0.0086)*p^2+(0.0000)*v^2+(0.0000)*p*v

VII. Resources Required


S. No. Name of Resource Suggested Broad Specification Quantity
1 Computer (intel i7 or above) 1 for each
2 MATLAB Latest version as required

VIII. Precautions
a) Handle the computer safely.

IX. Procedure
Do the following steps to evolve and execute the MATLAB program:
1. Switch-on the computer.
2. Open the MATLAB software.

Page 59 of 61
3. Open new live script.
4. Interpret the given problem and the corresponding MATLAB codes of example 1 as in section
VI.
5. Input the sample data as in line no. 4 of example 1.
6. Create a matrix with p−¿values, p2−¿ values, v−¿values, etc. from the given data as in line
no. 8 of example 1.
7. Display the fitted surface equation as in line no. 12 of example 1.
8. Generate the grid from the regression data as in line no. 15 of example 1.
9. Plot the regression surface as in line no. 18 of example 1.
10. Interpret the algorithm developed in this MATLAB program developed by you.
11. Check the obtained result with the faculty at the end of this practicum.
12. Repeat step 1 to 9 If the result is wrong repeat lines 1 to 24 as seen in Example 1 in
‘Underpinning Theory’.
13. Save the developed MATLAB program with your name.
14. Run the saved MATLAB program codes.
15. Develop MATLAB programmes for the additional problems:
16. Using MATLAB fit a regression surface for the following problems by applying second-order
polynomial regression and display the fitted equation and surface plot and repeat 1 to 9:
(i). Fit a regression surface to model humidity (%) based on temperature (°C) and
wind speed (m/s) using MATLAB. Use the following dataset:
Temperature (°C):[15, 20, 25, 30, 35]
Wind Speed (m/s): [2.0, 2.5, 3.0, 3.5, 4.0]
Humidity (%): [60, 65, 70, 75, 80]
(ii). Fit a regression surface to model sales revenue (in $1000s) based on advertising
budget (in $1000s) and number of salespersons using MATLAB. Use the following
dataset: Advertising Budget ($1000s): [10, 15, 20, 25, 30]
Number of Salespersons: [5, 6, 7, 8, 9]
Sales Revenue ($1000s): [50, 60, 70, 80, 90]
(iii). Fit a regression surface to model crop yield (tons/ha) based on rainfall (mm)
and fertilizer use (kg/ha) using MATLAB. Use the following dataset:
Rainfall (mm): [800, 850, 900, 950, 1000]
Fertilizer Use (kg/ha): [50, 55, 60, 65, 70]
Crop Yield (tons/ha): [2.5, 2.8, 3.1, 3.4, 3.7].
17. Close the MATLAB software.
18. Switch-off the computer.

X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable

XI. Results (To be provided by students)

XII. Interpretation of Results (Students to provide meaning to above results)

XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).

XIV. Sample Practicum Related Questions


a) In line 9, what does the expression “p.*v” represent? How it is different from “p*v”?
b) Why is X \ t used instead of X / t?

XV. References/Suggestions for Further Reading


a) Applied numerical methods with MATLAB for engineers and scientists by Steven C.
Chapra, McGraw-Hill, 2012. (ISBN: 978-0-07-340110-2).

Page 60 of 61
b) MATLAB : An Introduction with Applications by Amos Gilat, New Delhi: Wiley India,
2004. (ISBN: 9788126513949).

XVI. Suggested Assessment Scheme (The performance indicators and their weightages will differ
from practicum-to-practicum).
The performance indicators given serves as a guideline for assessment regarding the ‘process-
related skills/LOs’ (marks to be awarded in real-time in the laboratory by the faculty member,
as these cannot be measured after practicum is over) and ‘product-related skills/LOs’.

Performance indicators Weightage Marks Obtained


1 Clear understanding of Problem and 10%
Algorithm/Flowchart/Pseudocode
2 Implementation using MATLAB (with appropriate 30 %
functions)
3 Structured Coding and Workflow Execution 10 %
4 Expected Result 20 %
5 Findings from the Results 5%
6 Viva-voce 10 %
7 Challenging in Hackerank / Leetcode 05 %
8 Submit the Record Notebook in time 10%
Total 100 %

Names of Student Team Members

 ……………………..

 ……………………….

 …………………………

Marks Obtained Dated signature of Teacher


Process Product Total
Related (5) Related (5) (10)

Page 61 of 61

You might also like