Mathematics Practicum Manual 2025
Mathematics Practicum Manual 2025
for
MATHEMATICS
(Course Code: 5BS1413)
Semester – V
2025
Department
of
Pure and Applied Mathematics
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.
Page 2 of 61
Contents
Page 3 of 61
List of Industry Specific Skills that will be Developed
through this Mathematics course
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.
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
Page 6 of 61
Iteration 10: c = 1.520996, f(c) = -0.002279
f(root) = 0.000259
VIII. Precautions
a) Handle the computer safely.
X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
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.
……………………..
……………………….
…………………………
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.
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
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
VIII. Precautions
a) Handle the computer safely.
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
Page 11 of 61
……………………..
……………………….
…………………………
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
VIII. Precautions
a) Handle the computer safely.
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)
……………………..
……………………….
…………………………
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
Output
Converged in 8 iterations
Solution:
1.2822
-2.5069
1.1915
Page 18 of 61
6 MATLAB Letest version as required
VIII. Precautions
a) Handle the computer safely.
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)
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 %
……………………..
……………………….
…………………………
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.
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
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
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.
Page 22 of 61
Do the following steps to evolve and execute the MATLAB program:
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)
x f(x)
1 2.72
1.1 3
1.2 3.32
1.3 3.67
1.4 4.06
x f(x)
0.5 1.6487
1 2.7183
1.5 4.4817
Page 23 of 61
2 7.3891
x f(x)
10 100
15 225
20 400
25 625
……………………….
……………………….
……………………….
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.
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
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)
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).
……………………..
……………………….
…………………………
Page 28 of 61
Practicum No.7 Date:………….
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.
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
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
Page 30 of 61
VIII. Precautions
a) Handle the computer safely.
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)
Page 31 of 61
XIII. Conclusions (Actions/decisions to be taken based on the interpretation of results).
……………………..
……………………….
…………………………
Page 32 of 61
Practicum No.8 Date:………….
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
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);
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)
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 %
……………………..
……………………….
…………………………
Page 35 of 61
Practicum No.9 Date:………….
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
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
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)
Page 37 of 61
Names of Student Team Members
……………………..
……………………….
…………………………
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.
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
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
VIII. Precautions
1. Handle the computer safely.
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 ].
X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
……………………..
……………………….
…………………………
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.
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
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 .
VIII. Precautions
a) Handle the computer safely.
X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Page 44 of 61
Not Applicable
……………………..
……………………….
…………………………
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.
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
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.
VIII. Precautions
a) Handle the computer safely.
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
X. Observations and Recordings (Students record and use the page on left side if space is not
sufficient)
Not Applicable
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 %
……………………..
……………………….
…………………………
Page 49 of 61
Practicum No.13 Date:………….
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.
R x , yz =
√ r 2xy +r 2xz−2r xy r xz r yz
1−r 2yz
.
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)]);
VIII. Precautions
b) Handle the computer safely.
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)
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 %
……………………..
……………………….
…………………………
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.
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
Example 1: From a sample dataset, compute the partial correlation between temperature and
energy consumption controlling for humidity using MATLAB.
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
VIII. Precautions
a) Handle the computer safely.
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
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 %
……………………..
……………………….
…………………………
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.
V. Related ADO(s)
a) Adhere to laboratory safety protocols.
b) Perform as an effective leader.
Example 1: Fit a regression surface to model temperature (°C) based on pressure (kPa) and volume
(L) using MATLAB. Use the following dataset:
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
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
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’.
……………………..
……………………….
…………………………
Page 61 of 61