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

Scientific Comp Lab

The document is a practical record for students at Bharathi Women's Arts and Science College, detailing exercises in SCILAB, Python, and Excel for the Department of Computer Science & Application. It includes various programming tasks such as matrix manipulation, solving equations, and generating Fibonacci sequences. The document serves as a certificate of completion for practical work submitted for university examination.

Uploaded by

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

Scientific Comp Lab

The document is a practical record for students at Bharathi Women's Arts and Science College, detailing exercises in SCILAB, Python, and Excel for the Department of Computer Science & Application. It includes various programming tasks such as matrix manipulation, solving equations, and generating Fibonacci sequences. The document serves as a certificate of completion for practical work submitted for university examination.

Uploaded by

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

BHARATHI WOMEN’S ARTS AND SCIENCE COLLEGE

(AN ISO 9001-2000 CERTIFIED INSTITUTION)

THATCHUR, KALLAKURICHI-606213.

DEPARTMENT OF COMPUTER SCIENCE & APPLICATION

NAME : …………………………………………………………………………………………

COURSE : …………………………………………………………………………………………

REGISTER NO : …………………………………………………………………………………………
BHARATHI WOMEN’S ARTS AND SCIENCE COLLEGE
(AN ISO 9001-2000 CERTIFIED INSTITUTION)
THATCHUR, KALLAKURICHI-606213.

DEPARTMENT OF COMPUTER SCIENCE & APPLICATION

CERTIFICATE

Certificate that this is the bonafide record of practical done by …………………………….

………………………………. Register Number …………………………………. year/Branch

…………………In the lab ……………………………………………………………During the

academic year………………………

Faculty Incharge Head of the Department

Submitted for the University Practical Examination held on……………………

Internal Examiner External Examiner


SUB. CODE: [Link]:

SL PAGE
DATE CONTENT SIGN
NO NO

SECTION-A
EXERCISES USING SCILAB

1 MATRIX MANIPULATION

2 SOLVING LINEAR EQUATION

3 SOLVING QUADRATIC EQUATION

SIMPLIFICATION OF MATHEMATICAL
4 EXPRESSION

5 FIBONACCI NUMBER

SECTION B
EXERCISES USING PYTHON

1 SOLVING QUADRATIC EQUATION

2 CHECK LEAP YEAR

a)CHECK PRIME NUMBER


3 b)PRINT ALL PRIME NUMBER BETWEEN
IN AN INTERVAL

4 FIBONACCI SEQUENCE

5 FINDING LCM & HCF

SECTION C
EXERCISES USING EXCEL

PLOTTING BAR CHART


1
& SCATTER CHART

2 PLOTTING HISTOGRAM & PIE CHART

MEASURES OF CENTRAL TENDENCY


3
MEAN, MEDIAN, MODE

MEASURES OF DISPERSION
4
STD. DEVIATION, MEAN DEVIATION

REGRESSION AND CORRELATION.


5
LINEAR MODELS
Section-A
Exercises using
MATLAB or SCILAB
MATRIX MANIPULATION
*****************************
[Link]

// Define matrices

A = [1 2 3; 4 5 6];

B = [7 8 9; 10 11 12];

// Matrix addition

C = A + B;

// Scalar multiplication

D = 2 * A;

// Matrix multiplication

E = A * B';

// Element-wise multiplication

F = A .* B;

// Transpose of A

A_T = A';

// Inverse of a 2x2 matrix

M = [1 2; 3 4];

M_inv = inv(M);

// Determinant

detM = det(M);

// Extract elements

elem = A(1, 2);

first_row = A(1, :);

second_col = A(:, 2);

// Submatrix
subA = A(1:2, 2:3);

// Concatenation

H_concat = [A, B];

V_concat = [A; B];

// Display results

disp("Mattrix Manipulation");

disp("**********************");

disp("Matrix A:"), disp(A);

disp("Matrix B:"), disp(B);

disp("Matrix C (A + B):"), disp(C);

disp("Matrix D (2 * A):"), disp(D);

disp("Matrix E (A * B dash):"), disp(E);

disp("Matrix F (A .* B):"), disp(F);

disp("Transpose of A:"), disp(A_T);

disp("Inverse of M:"), disp(M_inv);

disp("Determinant of M:"), disp(detM);

disp("Element at A(1,2):"), disp(elem);

disp("First row of A:"), disp(first_row);

disp("Second column of A:"), disp(second_col);

disp("Submatrix of A:"), disp(subA);

disp("Horizontal concatenation of A and B:"), disp(H_concat);

disp("Vertical concatenation of A and B:"), disp(V_concat);


Output:

Matrix Manipulation
*********************
Matrix A:
1. 2. 3.
4. 5. 6.
Matrix B:
7. 8. 9.
10. 11. 12.

Matrix C (A + B):
8. 10. 12.
14. 16. 18.

Matrix D (2 * A):
2. 4. 6.
8. 10. 12.

Matrix E (A * B dash):
50. 68.
122. 167.

Matrix F (A .* B):
7. 16. 27.
40. 55. 72.

Transpose of A:
1. 4.
2. 5.
3. 6.

Inverse of M:
-2. 1.
1.5 -0.5
Determinant of M:
-2.

Element at A(1,2):
2.

First row of A:
1. 2. 3.

Second column of A:
2.
5.

Submatrix of A:
2. 3.
5. 6.

Horizontal concatenation of A and B:


1. 2. 3. 7. 8. 9.
4. 5. 6. 10. 11. 12.

Vertical concatenation of A and B:


1. 2. 3.
4. 5. 6.
7. 8. 9.
10. 11. 12.
LINEAR EQUATIONS

[Link]

// Define the coefficient matrix A and the constant matrix B

A = [2, 3; 4, 1];

B = [5; 6];

disp("Solving Linear Equation")

disp("______________________")

// Solve using linsolve function

X1 = linsolve(A, B);

disp("Solution using linsolve:");

disp(X1);

// Solve using the backslash operator

X2 = A \ B;

disp("Solution using backslash operator:");

disp(X2);
Output:

Solving Linear Equation

______________________

Solution using linsolve:

-1.3

-0.8

Solution using backslash operator:

1.3

0.8
QUADRATIC EQUATIONS

[Link]

function roots=solveQuadratic(a, b, c)
// Calculate the discriminant
discriminant = b^2 - 4*a*c;
if discriminant > 0 then
// Two real and distinct roots
root1 = (-b + sqrt(discriminant)) / (2*a);
root2 = (-b - sqrt(discriminant)) / (2*a);
roots = [root1, root2];
disp("The equation has two distinct real roots:");
elseif discriminant == 0 then
// One real root (repeated)
root = -b / (2*a);
roots = [root, root];
disp("The equation has one repeated real root:");
else
// Complex roots
realPart = -b / (2*a);
imaginaryPart = sqrt(-discriminant) / (2*a);
root1 = realPart + %i * imaginaryPart;
root2 = realPart - %i * imaginaryPart;
roots = [root1, root2];
disp("The equation has two complex roots:");
end
disp("Root1 & Root 2 are: ");
disp(roots);
endfunction
a = 1;
b = 5;
c = 6;
disp("Solving Quadratic Equation");
disp("----------------------------");
disp("Equation:x^2+5x+6");
solveQuadratic(a, b, c);
Output:

Solving Quadratic Equation


----------------------------
Equation:x^2+5x+6
The equation has two distinct real roots:
Root1 & Root 2 are:
-2. -3.
SIMPLIFICATION OF MATHEMATICAL EXPRESSION

[Link]

// Define the polynomial variable x


x = poly(0, 'x');
// Define the numerator and denominator
numerator = x^2 + 2*x + 1;
denominator = x + 1;
disp("Simplification of Mathematical expression");
// Perform polynomial division
[quotient, remainder] = pdiv(numerator, denominator);
disp("Numerator:");
disp(numerator);
disp("Denominator:");
disp(denominator);
if remainder == 0 then
disp("The expression simplifies to:");
disp(quotient);
else
disp("The simplified expression is:");
disp(remainder );
end
Output:

Simplification of Mathematical expression


Numerator:
1 +2x +x2
Denominator:
1 +x
The simplified expression is:
1 +x
FIBONACCI NUMBER

[Link]

function result=fibonacci(n)
// Recursive function to get the nth Fibonacci number
if n <= 0 then
result = 0;
elseif n == 1 then
result = 1;
else
result = fibonacci(n-1) + fibonacci(n-2);
end
endfunction
// Define the number of Fibonacci numbers you want
n = 10; // For example, to get the first 10 Fibonacci numbers
fib_sequence = zeros(1, n);
for i = 1:n
fib_sequence(i) = fibonacci(i-1); // Fibonacci sequence starts with 0 end
// Display the Fibonacci sequence
disp("Fibonacci Sequence:");
disp(fib_sequence);
OUTPUT:

Fibonacci Sequence:
0. 1. 1. 2. 3. 5. 8. 13. 21. 34.
Section B
Exercises using
Python
PYTHON PROGRAM TO SOLVE QUADRATIC EQUATION

[Link]

import cmath
def solve_quadratic(a, b, c):
# Calculate the discriminant
d = (b ** 2) - (4 * a * c)
# Find two solutions
sol1 = (-b - [Link](d)) / (2 * a)
sol2 = (-b + [Link](d)) / (2 * a)
return sol1, sol2
a = float(input("Enter coefficient a: "))
b = float(input("Enter coefficient b: "))
c = float(input("Enter coefficient c: "))
solution1, solution2 = solve_quadratic(a, b, c)
print(f "The solutions are {solution1} and {solution2}")
OUTPUT:

Enter coefficient a: 1

Enter coefficient b: -3

Enter coefficient c: 2

The solutions are (1+0j) and (2+0j)


PYTHON PROGRAM TO CHECK LEAP YEAR

[Link]

# Function to check if a year is a leap year


def is_leap_year(year):
if (year % 4 == 0):
if (year % 100 == 0):
if (year % 400 == 0):
return True
else:
return False
else:
return True
else:
return False

print (f"Leap Year Finder")


print(f"*******************")
while True:
year = input ("Enter a year (or 'exit' to quit): ")
if [Link]() == 'exit':
print("Goodbye!")
break
if [Link]():
year = int(year)
if is_leap_year(year):
print(f"{year} is a leap year.")
else:
print(f"{year} is not a leap year.")
else:
print ("Invalid input. Please enter a valid year or type 'exit' to quit.")
Output

Leap Year Finder

*******************

Enter a year (or 'exit' to quit): 2024


2024 is a leap year.
Enter a year (or 'exit' to quit): 2021
2021 is not a leap year.
Enter a year (or 'exit' to quit): exit
Goodbye!
CHECK PRIME NUMBER

[Link]

def is_prime(n):
"""Check if a number is prime."""
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
print("Prime Number Finder")
print("********************")
while True:
user_input = input("Enter a [Link] check if it's prime (or type 'exit' ): ").strip()
if user_input.lower() == 'exit':
print("Exiting the program.")
break
if not user_input.isdigit():
print("Please enter a valid number.")
continue
number = int(user_input)
if is_prime(number):
print(f"{number} is a prime number.")
else:
print(f"{number} is not a prime number.")
Output:

Prime Number Finder

********************

Enter a number to check if it's prime (or type 'exit' to quit): 19

19 is a prime number.

Enter a number to check if it's prime (or type 'exit' to quit): 8

8 is not a prime number.

Enter a number to check if it's prime (or type 'exit' to quit): 7

7 is a prime number.

Enter a number to check if it's prime (or type 'exit' to quit): exit

Exiting the program.


PRIME NUMBERS BETWEEN AN INTERVALS

[Link]
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
def get_prime_numbers_in_interval(lower, upper):
prime_numbers = []
for num in range(lower, upper + 1):
if is_prime(num):
prime_numbers.append(num)
return prime_numbers
print("Prime Numbers between Ranges")
print("*****************************")
def main():
while True:
try:
lower_bound = int(input("Enter the Starting Number: ").strip())
upper_bound = int(input("Enter the Last Number: ").strip())
if lower_bound > upper_bound:
print("Starting No. should be less than or equal to Last No.")
continue
prime_numbers = get_prime_numbers_in_interval(lower_bound,
upper_bound)
if prime_numbers:
print(f"Prime numbers in the interval [{lower_bound}, {upper_bound}]:
{prime_numbers}")
else:
print(f"There are no prime numbers in the interval [{lower_bound},
{upper_bound}].")
break
except ValueError:
print("Please enter valid integer values for the interval bounds.")
if __name__ == "__main__":
main()
Output:

Prime Numbers between Ranges


*****************************
Enter the Starting Number: 10
Enter the Last Number: 50
Prime numbers in the interval [10, 50]: [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
FIBONACCI SEQUENCE

[Link]

def fibonacci_sequence(n):
sequence = []
a, b = 0, 1
while len(sequence) < n:
[Link](a)
a, b = b, a + b
return sequence
print("Fibonacci Series")
print("******************")
# Get input from the user
num_terms = int(input("Enter the number of terms in the Fibonacci sequence: "))
# Print the Fibonacci sequence
if num_terms <= 0:
print("Please enter a positive integer.")
else:
sequence = fibonacci_sequence(num_terms)
print("Fibonacci sequence:")
print(sequence)
Output:

Fibonacci Series
******************
Enter the number of terms in the Fibonacci sequence: 10
Fibonacci sequence:
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
LCM/ HCF CALCULATOR

[Link]

import math
def find_lcm(a, b):
return abs(a * b) // [Link](a, b)
def find_hcf(a, b):
return [Link](a, b)
print("LCM AND HCF CALCULATOR")
print("*************************")
def main():
while True:
print("\nMenu:")
print("1. Find LCM")
print("2. Find HCF")
print("3. Exit")
choice = input("Enter your choice (1/2/3): ")
if choice == '1' or choice == '2':
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
if choice == '1':
lcm = find_lcm(num1, num2)
print(f"The LCM of {num1} and {num2} is {lcm}.")
elif choice == '2':
hcf = find_hcf(num1, num2)
print(f"The HCF of {num1} and {num2} is {hcf}.")
elif choice == '3':
print("Exiting the program.")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()
Output:

LCM AND HCF CALCULATOR


*************************
Menu:
1. Find LCM
2. Find HCF
3. Exit
Enter your choice (1/2/3): 1
Enter first number: 12
Enter second number: 16
The LCM of 12 and 16 is 48.

Enter your choice (1/2/3): 1


Enter first number: 10
Enter second number: 25
The LCM of 10 and 25 is 50.

Enter your choice (1/2/3): 2


Enter first number: 10
Enter second number: 25
The HCF of 10 and 25 is 5.

Enter your choice (1/2/3): 3


Exiting the program.
Section C
Exercises using
Excel
BAR CHART
Aim:
To create a Bar chart using Excel
Procedure:
1. Enter Your Data
a) Open Excel and enter your data into a worksheet.
b) Arrange your data in columns or rows, with the categories (e.g., months,
products) in one column or row and the corresponding values in the
adjacent column or row.
2. Select Your Data
a) Click and drag to select the data you want to include in your chart.
3. Insert the Bar Chart
a) Go to the Insert tab on the Excel Ribbon.
b) In the Charts group, click on the Bar Chart icon.
c) Choose the type of bar chart you want to use. Common options are:
i. Clustered Bar: Displays values side by side.
ii. Stacked Bar: Stacks values on top of each other.
iii. 100% Stacked Bar: Shows relative percentages of a whole.
4. Customize Your Chart
a) Once the chart is inserted, you can customize it using the Chart Tools that
appear.
b) You can change the chart title, axis labels, and style.
c) To edit the chart's data, right-click on the chart and select Data.
5. Final Adjustments
a) Adjust the chart size by clicking and dragging the edges.
b) Add labels, change Colors, or format the chart as needed.
6. Our bar chart is now ready!
OUTPUT:

COLUMN CHART
SCATTER PLOT
Aim:
To create a Scatter Plot (Chart) using Excel

Procedure:
1. Prepare Your Data
a) Enter Your Data:
a. Organize your data in Three columns.
2. Select the Data
a) Highlight Your Data: Click and drag to select both columns (including
headers if you have them).
3. Insert the Scatter Plot
a) Go to the 'Insert' Tab: In Excel, navigate to the `Insert` tab on the ribbon.
b) Choose Scatter Plot:
i. Click on the `Scatter (X, Y) or Bubble Chart` icon in the
`Charts` group.
ii. Choose the type of scatter chart you want. Usually, you would
select the first option, which is a simple scatter plot with only
markers (no lines).
4. Customize the Scatter Plot
a) Add Titles and Labels:
i. Chart Title: Click on the chart title to edit it.
ii. Axis Titles: Go to the `Chart Tools > Design` tab, click on `Add
Chart Element > Axis Titles`, and add titles for both the X and Y
axes.
b) Adjust Axis Scales:
i. Right-click on the axis you want to change and select `Format
Axis`.
ii. Adjust the minimum, maximum, and major unit values as
needed.
c) Change Marker Styles:
i. Click on the markers in the chart.
ii. Go to the `Format` tab in the `Chart Tools`, and you can adjust
the marker styles, colors, and sizes.
5. Finalize the Chart
a. Move/Resize the Chart: Click and drag the chart to reposition it, and
use the corners to resize it as needed.
b. Save Your Work: Remember to save your Excel file.
6. Our scatter plot is now ready! This chart will visually show the relationship
between the two years (2023- 2024) result analysis.
OUTPUT:
PLOTTING A HISTOGRAM

Aim:

To prepare Admission Analysis report by plotting a histogram in Excel

Procedure:

1. Prepare Your Data


a. Enter your data into a column in an Excel worksheet. Ensure your data
is organized in a single column without any blanks.
b. For example, place your data in Column A, starting from A1.
2. Select Your Data
a. Highlight the data you want to include in your histogram. Click and
drag from the first cell of your data to the last cell.
3. Insert a Histogram Chart
a. Go to the "Insert" tab on the Ribbon.
b. In the "Charts" group, click on the "Insert Statistic Chart" button. This
is usually represented by a small histogram icon.
c. From the drop-down menu, choose "Histogram".
4. Customize Your Histogram
a. Adjust the Bin Settings:
i. Click on the histogram chart to select it.
ii. Right-click on the horizontal axis (the bins) and choose "Format
Axis".
iii. In the "Format Axis" pane, you can adjust the bin width, number
of bins, and other settings according to your preference.
b. Modify Chart Title and Labels:
i. Click on the chart title to edit it. You can type a new title that
describes your data.
ii. You can also add or edit axis labels by selecting the chart and
using the "Chart Elements" button (the plus sign) next to the
chart.
5. Adjust Chart Design
a. You can change the chart style and colors by going to the "Chart Tools"
section on the Ribbon, which appears when the chart is selected.
b. Use the "Design" and "Format" tabs to choose a different chart style or
modify colors and other formatting options.
6. Finalize and Save
a. Review your histogram to ensure it accurately represents your data.
b. Click on "File" and then "Save" to save your Excel workbook with the
histogram.
Output:

Bins: by Category

Bins: by number of bins


PLOTTING A PIE CHART

Aim:

To prepare Admission Analysis report by plotting a Pie Chart in Excel

Procedure:

1. Prepare Your Data


a. Enter your data into an Excel worksheet. Your data should be organized
in two columns:
i. One column for categories (e.g., different types of expenses).
ii. One column for values (e.g., the amount spent on each type).
2. Select Your Data
a. Highlight the data that you want to include in the pie chart. Click and
drag to select both the category names and the corresponding values.
3. Insert a Pie Chart
a. Go to the "Insert" tab on the Ribbon.
b. In the "Charts" group, click on the "Pie Chart" button. This is
represented by a pie chart icon.
c. From the drop-down menu, choose the type of pie chart you want to
create. You can select from options like:
i. "2-D Pie" for a simple pie chart.
ii. "3-D Pie" for a three-dimensional effect.
iii. "Doughnut" for a ring-shaped pie chart.
4. Customize Your Pie Chart
a. Edit Chart Title:
i. Click on the chart title to edit it. You can type a new title that
reflects the data being represented.
b. Add Data Labels:
i. Click on the pie chart to select it.
ii. Click on the "Chart Elements" button (the plus sign) next to the
chart.
iii. Check the "Data Labels" option to display labels on the pie slices.
iv. You can format these labels by clicking on them and choosing
"Format Data Labels" to show percentages, values, or categories.
c. Change Chart Style:
i. Click on the pie chart to select it.
ii. Go to the "Chart Tools" section on the Ribbon (which appears
when the chart is selected).
iii. Use the "Design" tab to choose a different chart style or color
scheme.
5. Adjust Chart Design
a. Format Slices:
i. Click on any pie slice to select it.
ii. Right-click and choose "Format Data Series" to change the color,
explode (separate) slices, or adjust other formatting options.
b. Add Legends or Labels:
i. Use the "Chart Elements" button to add or adjust the legend or
labels.
6. Finalize and Save
a. Review your pie chart to ensure it accurately represents your data.
b. Click on "File" and then "Save" to save your Excel workbook with the
pie chart.
Output:
MEAN, MEDIAN, AND MODE

Aim:

To calculate the mean, median, and mode using Excel

Procedure:

1. Open Microsoft Excel Sheet & prepare Data sheet


2. Mean (Average)
Step 1: Enter your data in a column (e.g., C4:C15for your 12 months' runs).
Step 2: Click on the cell where you want the mean to be displayed.
Step 3: Use the `AVERAGE` function:
a. Type `=AVERAGE(C4:C15)` and press Enter.
b. This will calculate the mean (average) of the numbers in the range C4
to C15.
3. Median
Step 1: Ensure your data is entered in a column (e.g., C4:C15).
Step 2: Click on the cell where you want the median to be displayed.
Step 3: Use the `MEDIAN` function:
a. Type `=MEDIAN(C4:C15)` and press Enter.
b. This will calculate the median of the numbers in the range C4 to C15.
4. Mode
Step 1: Enter your data in a column (e.g., C4:C15).
Step 2: Click on the cell where you want the mode to be displayed.
Step 3: Use the `[Link]` function:
c. Type `=[Link](C4:C15)` and press Enter.
d. This will calculate the mode of the numbers in the range C4 to C15.
5. Save the file & Exit
Output:
Standard Deviation, Mean, and Mean Deviation Using Excel

Aim:

To calculate the Standard Deviation, Mean, and Mean Deviation as shown in


the picture using Excel.

Procedure:

1. Entering the Data


a. Enter the Month names in Column B (B2 to B13).
b. Enter the India child birth data in Column C (C4 to C15).
2. Calculating the Mean
c. In cell C18 (or any other cell where you want the result):
d. Type the formula: `=AVERAGE(C4:C15)`
e. Press Enter.
f. This will calculate the mean (average) of the child births for the year.
3. Calculating the Deviation
g. Deviation is the difference between each month's data and the mean.
h. In Cell D4:
i. Type the formula: `=ABS(C4 - $C$18)`
j. Press Enter.
k. Drag this formula down from D4 to D15. The `$C$18` reference will
stay fixed as it refers to the mean value.
4. Calculating the Standard Deviation
l. In cell C17 (or any other cell where you want the result):
m. Type the formula: `=STDEV.S(C4:C15)`
n. Press Enter.
o. This will calculate the sample standard deviation of the child births for
the year.
5. Calculating the Mean Deviation
p. In cell C19 (or any other cell where you want the result):
q. Type the formula: `=AVERAGE(D2:D13)`
r. Press Enter.
s. This will calculate the mean of the absolute deviations (mean deviation)
for the data.
Output
REGRESSION AND CORRELATION

Aim:

To calculate Regression and correlation using Excel

Procedure

1. Enter the Data:


a. In Excel, enter the ( X ) values (independent variable) in one column
(e.g., Column A) and the ( Y) values (dependent variable) in the next
column (e.g., Column B).
2. Calculating Correlation:
a. Click on an empty cell, and use the formula: `=CORREL(A4:A13,
B4:B13)` to find the correlation between( X ) and ( Y ). This gives a
measure of how strongly related the variables are.
3. Running Linear Regression:
a. Go to `Data` > `Data Analysis` > `Regression`.
b. Set the Input Y Range to the ( Y) values and the Input X Range to the (
X) values
c. Check `Labels` if you've included headers, and choose the output
location.
d. Click `OK` to see the regression output.
4. Scatter Plot with a Regression Line:
a. Select the data, go to `Insert` > `Scatter` > `Scatter with only
Markers`.
b. Add a trendline by selecting the chart, going to `Chart Tools` >
`Design` > `Add Chart Element` > `Trendline` > `Linear`.
Output

You might also like