ELEC372 Lab1
ELEC372 Lab1
Note: The Lab#1 has 2 sections containing 5 parts in total. The (expected) required time for each
part is highlighted (you may manage your time for providing & submitting your report).
Each group needs to submit one [see the example bellow].pdf report as the following format:
Group name (based on 4 members):
1- Your first name, Your last name, Your student id
2- Your first name, Your last name, Your student id
3- Your first name, your last name, Your student id
4- Your first name, your last name, Your student id
1
Lab 1
Example:
Lab#1
1- Alice, Spring, 12345678
2- Bob, Winter, 01234567
3- Joe, Fall, 98765432
Name of the .pdf file for the submission would be: Lab1_ASBWJF.pdf
Tasks
2
Lab 1
Section 2)
Repeat it with random matrices (e.g., rand(), randn() etc) with various dimensions.
3
Lab 1
4
Lab 1
2) Write a MATLAB function named “decTObin” that implement (design, write, debug)
the algorithm of decimal to Binary mentioned in LN#1 as follows: [expected time: 30
min]
Start
Integer N to be converted to
Input (N)10
binary format
i=0
i=i+1,N=Q
ai = R
No
Is Q = 0?
Yes
n=i
(N)10 = (an. . .a0)2
STOP
5
Lab 1
Start
Fraction F to be converted to
Input (F)10
binary format
i = −1
i = i − 1, F = 𝑇
ai = R
No
Is T =0?
Yes
n=i
(F)10 = (a-1. . .a-n)2
STOP
6
Lab 1
Then, write another MATLAB function named “DP_format” to take a decimal value
as an input and convert it to the double precision IEEE-754 format.