0% found this document useful (0 votes)
2 views

Lab 2 regression Analysis solved

The document outlines a lab report on Regression Analysis for the Instrumentation and Measurements Lab, detailing the procedure for fitting data and evaluating model accuracy. It includes tasks for creating vectors and performing operations in MATLAB, along with the importance of goodness-of-fit statistics. The conclusion emphasizes the learning outcomes related to regression analysis, model evaluation, and MATLAB usage.

Uploaded by

abdul bari
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lab 2 regression Analysis solved

The document outlines a lab report on Regression Analysis for the Instrumentation and Measurements Lab, detailing the procedure for fitting data and evaluating model accuracy. It includes tasks for creating vectors and performing operations in MATLAB, along with the importance of goodness-of-fit statistics. The conclusion emphasizes the learning outcomes related to regression analysis, model evaluation, and MATLAB usage.

Uploaded by

abdul bari
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DEPARTMENT OF AVIONICS ENGINEERING

SUBJECT : Instrumentation and Measurements Lab


SUBJECT CODE : 305346
LAB NO : 02

TITLE : Regression Analysis

SUBMITTED TO : Ms. Shifa Nadeem


SEMESTER : 6th
SECTION : B

Marks Obtained
Group Member Group Member
1 2
NAME MAHNOOR
REGISTRATION # 220701002
LAB REPORT 2
PERFORMANCE
TOTAL MARKS

DEADLINE: 10-03-2025
DATE OF SUBMISSION: 10-03-2025

Instrumentation and Measurements Lab Page 1 Experiment # 2


Introduction
❖ Regression Analysis is used to find a mathematical relationship between
independent and dependent variables.
❖ In regression analysis, curve fitting is the process of specifying the model that
provides the best fit to the specific curves in your dataset
❖ A well-fitting regression model results in predicted values close to the observed
data values.
❖ You can also use regression to make future predictions
Procedure:
1. Open the curve fitting toolbox
2. Import values of dependent and independent variables
3. Fitting the data using different equations
4. Determining the best fit
5. Prediction of the future values

❖ Open the curve fitting toolbox by typing the following command in the command
window.
>>cftool

Instrumentation and Measurements Lab Page 2 Experiment # 2


Evaluating the goodness of fit
Visual Examination (graphical analysis)
1. Fitting Curve
2. Residual analysis
residuals from a fitted model are defined as the differences between the response data and
the fit to the response data at each predictor value.
residual = data – fit (y-x)
the residual for a specific predictor value is the difference between the response value y
and the predicted response value x.
If you see a pattern in the residual plots, your model doesn’t provide an adequate fit for the
data.
Numerical Analysis
Goodness of fit Statistics
❖ Examine Goodness of fit statistics
❖ Curve fitting tool supports the following goodness of fit statistics
1. The sum of square due to error (SSE)
Error between data points and models predicted values
(should be close to 0 for best fit)
2. R-squared

Instrumentation and Measurements Lab Page 3 Experiment # 2


3. Adjusted R-squared (should be close to 1 for best fit)
4. Root Mean Square Error (RMSE)*
It indicates how close the observed data points are to the model’s predicted values.
(should be close to 0 for best fit)
These results are displayed in results as well as table of fits.

LAB TASKS:
TASK 01
1. Create the vector consisting of the whole even numbers between 15 and 27
Code: Result:

2. Create the vector consisting of the whole odd numbers between 15 and 27.

Code: Result:

3. Create the vector of the previous question in decreasing order.

Code: Result:

TASK 02
❖ Let x = [2 5 1 6].
1. Add 16 to each element
Code: Result:

2. Add 3 to just the odd-index elements AND put the result in the even positions of the
original vector

Instrumentation and Measurements Lab Page 4 Experiment # 2


Code: Result:

3. Compute the square root of each element


Code: Result:

4. Compute the square of each element


Code: Result:

TASK 03
Suppose we have a vector X which includes Area of plots and vector Y consisting of their
prices. Such that
MATLAB command window:
X= 10:10:90;
Y= [100,150,250,300,320,360,400,450,600];
Residual plot:

Instrumentation and Measurements Lab Page 5 Experiment # 2


Main plot:

Full window of cftool:

Conclusion:
From this lab, we have learned:
• How to perform regression analysis to find relationships between variables.
• The importance of evaluating model accuracy using goodness-of-fit metrics.
• Basic MATLAB operations for data manipulation and analysis.
• How to use MATLAB for vector operations and implementing regression models.

Instrumentation and Measurements Lab Page 6 Experiment # 2

You might also like