summaryrefslogtreecommitdiff
path: root/1238/CH8/EX8.1/8_1.sce
blob: 2deb93114b18af606e114c59d0653302576fe11b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//finding binary equivalent weights//
//example 1//
clc
//clears the command window//
clear
//clears// 
n=6;//no. of bits//
LSB1=1/((2^6)-1)
printf('weight of 1st lsb=%f\n',LSB1)
LSB2=2*LSB1
printf('weight of 2nd lsb=%f\n',LSB2)
LSB3=4*LSB1
printf('weight of 3rd lsb=%f\n',LSB3)
LSB4=8*LSB1
printf('weight of 4th lsb=%f\n',LSB4)
LSB5=16*LSB1
printf('weight of 5th lsb=%f\n',LSB5)
MSB=32*LSB1
printf('weight of msb=%f',MSB)
//results are displayed//