0% found this document useful (0 votes)
37 views12 pages

Book 16 Apr 2024

The document contains code to perform operations on two arrays named a and b. It defines the arrays, prints them out, then uses a nested for loop to iterate through the arrays and assign the product of each pair of elements from a and b to a new array A.

Uploaded by

clickcartoon50
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)
37 views12 pages

Book 16 Apr 2024

The document contains code to perform operations on two arrays named a and b. It defines the arrays, prints them out, then uses a nested for loop to iterate through the arrays and assign the product of each pair of elements from a and b to a new array A.

Uploaded by

clickcartoon50
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
You are on page 1/ 12

- - -

-
.. :I !xpia.sce fffi i•
. - . -···~
- -.•
[ Expt_ No.
Date ~1hJ2.
:
t
l clc;
. f
-
..,,
··\
Page No. (
]
2 disp("N ame-Ak shdeep S1ngh") ; 0
ii Fv A->, .. ,h>'I ...... f ... I
i 3 diSp(~R oll-no-3 542080 2822,•B ranch-!C !-A")I '
4 a-• 1:4;
''
A ~AM ( o_) :
.
. s b-• 1:2; .
(p-lcf.,. ,,.t 0. "Y'l'"U''l.th;y ,, ...
6 disp("A rray.a" );
,'A - ,.,.,,.,_A.,.t
.J 0
7 cusp (a);
AL.~ h • t J...,;w, ( 0..,) :'
8 disp("A rray-b" ); -' .
9 disp(b) ;
. I ~~,. ..+
10 for 1 • -l- : lent;eh( a) ') f". •-J: _ D:
q
·, ',.,, -J;,h, ,. - J h .
.
. I ~!,_
ll for-j •·l lengehl, bl. 0.:: \:'1.
')
12 A(1,j) • a (1) a b (j); 'b::i:1.·
·! 13 end 1,. L ·I: J:. /Al'~~ _-f-: .,,,._,._f,.
I 'i, . _, h. __j ' . • •_ ,.. L:-IL lo.)
- 14 end 7 -·· -·· • f d
1'
(1
D,. _-Jl, I
!'"'
I..)
! lS disp("T he-Ma~ r1x-w11 1-be"); a -
I
16 disp(A) ;
½ I l:r... .-.,1-;J IA,,,. ""L;
I
Jf, ... t - ,.,..
, • J 1. . J, • -f ,,,/_ d A _J h:
' V
' 17 ' . 11'\ r::.... ; L,,,..
V
I t. I, .JI I" II
-
")
I_
,II.:!.!. ~-- '-'",·
- ---- ----- ·--· (/
-~· -
•, •
I -I.
·:r4-'::'.'_
---- - -------·• _,.. b) r::::b . . ,• /_J,, A
l,...+Llb1
IJ •
a t
- -
-- ... ; r, ,,. j;; .fl _ / _ +. . : , ,
'
-
..
-- . .. - ....
.. -- • - - -
I
--:-- ~-
I~
r - ·· · - - - -
;
. . ~Ya~~~-"~:::-=~;c~,~~~~~~!:7?,:c•c~:-';·~p'i']Ji
II
•Name-Akahdeep SinQb•
• A
Heine ; Vu
4x2
Type
Double
I Visi,ity
local
Memory
2ne
- .
•Roll no-3St20802 822, B:anch-!CE-A.• •b (1, 2, 3, 4)
(1, 2J
Double local 2108 lh.,r
.9:\"r\~
Double local
I Double local
2248 •
2168
I
'
I
•A.r:tay a• 2 Double local 2168
\
I l. . 2. 3. ••
•- .
•Ar:ay b•
f
•I
l. 2. . \
"The HaCJ:1.x v1ll be•
I
I
l.
2.
2.
•• -
~/ f,
•• e.
Teacher's Signature :
-
Date 1=1hl_ i,
"&plb.sc e
[ Expt. No. _____l_ Page No. _2,_ J
1 /clc;
2 disr:,("N air.e-Ak shdeep- Singh");
1
3 rl1~r("R o11-nG- 3543Qe 03f33,·~ ~~nGh-E GE-A");
4 A= fl 2 3;~ 5 6;7 S SJ;
5 B = (1 0 O;O l O;O O l];
6 fm,n] = size(A) ;
7 (a, b) • size (B);
a disp("H atz:ix-A ");
9 disp (A);
10 d~sp("M atz:ix-B ");
11 d1..sp(B );
12 i f (n -= a)
13 disp("i nvalid- matz:ic es-to-m ultiply ");
141else
~:1 ~i=p~:, :~!!ult- will-be ";;
17 disp(C) ;
18 end
19
1-~~.i
------- --·1.- ;iJl'r -~,---;;;
Voriollle8'owser
Vu Type Vc!Hty Melay
"Ndlii..-Aluilult..•y Siiiyli"
I 0-I •.~-- :?:J) ~""-·! ~!-
3x3 llol&I ball! 2IICI s
3x3J Dlatiej 1oc.a1, 2808
1c Dolblej 2168
"Roll no-354208 02822, Branch-EC E-A" Ji loa,I
.I! 2168
1'. JI l>olJJlei -
41 Dolblej loc>,I. 2168
::.:r ::
"Matrix A" 2/ Dou>lej loc.alj 2168.
2168
ftiiE I ~, nu
1. 2. 3.
4. s. 6.
7. 8. 9. -..
/ "Matrix B"
l. o. 0.
o. 1. o.
o. 0. 1.
I "Result will be"
l. 2. 3.
4. 5. 6. Teacher's Signature :
7. 8. 9.
===>: :::::~
- - ,c...=; .,.._;= ===== :-==== ===== =====
vare J.J.J.2-.t1,,~_
Page No._J__ ]
Jqy:,• [ L. :.No.._ 1 , ~
Exp2a.sce l!CJ
l clc;
2 di !SP ( "Name-Ak.!hcteep. Singh") ;
3 di3p("Roll -no-354208 02822,•Bra nch-ECE-A ");
4 X "' -10 : 10;
s y = x••3 - 10· (X''2l ... s·x + 64;
6
7 plot (X, y) ;
a xlatel("~ ");
9 ylabel ( "Y") ;
10 t1tle("Pol ynom1al-f unction-x• •J.-.10• cx••2) ,+•8•x•+•6 4");
ll
Sdool,1,1-
"K•m•-Akahdeep Sin9h"
•~oll no-35420802822, Branch-tct-A"

-
, ,, x v....,..a,ow1•
--,

Voltt
lx)l -1 ----~Fl.
lXi
--
w
m
l>rl--~~---:ioi
e
ir-11:

,,-pix
__,
1 Ouphlc window""'""" 0
, Ille Teoh lclll I
0 X
-B-~ §§f
--l~~~I
210
I~Ti.
l _l)o,<blo ____
IoJ \' +16 21'8
I
loc.i
(IJ~ 4'
_D
ll--tiiiAii,
~-----;;«
o,..,_ _ ldl - 'DoJ,i,
-1-.----t----:!_-.• l"'t.t---,°"'.. "'"' !IU
Polynom11I Function x"3. 10'(11""2) • 8'X • 6A
200,-- -------- -------- -,
-
.JOO
--
.... , 000
,UGO
.,
.,....
... /
.....
-30IIO
,2300
•10 .. .. .. ,l ,.
Teacher's Signature: _ _ _ _ _ _ _ __
Date -'!. 9 kl~:i
Exp2b.sce /gj
[ Expt. No. ___i!e._____ Page No. --i-Lt_ ]
l clc;
2 disp("Name-Ak5hdeep-Singh ");
3 disp("Roll-no-35420802822 ,-Branch---ECE-A");
4 f = 0.2;
s t = 0:.0.1:10;
6 x • cos(2~~P~~t~f);
7 plot (t, X);
8 title('Plot-of-Cos(x) ');
9 xlabel ( 'x') ;
10 ylabel('Cos(x) ');
ill
,--.:r
-
:a:t!C.U~ '? X \';r::!J:Crcr,·,:u 'r p X
__,
f
Valot Tll)O l'odllty
Singh" loca :IJOB
loca
.,, ,
:IJOB
"Roll no-35420802822, Branch - ECE-A"
X

loca
be.,
loca
loca

21H
2161
2168
II I I I c;!¾, ~-\
Filo Took £dit I
local
ioul !:-:11 /

- ---·--
i~l-@.·~loJ~ loca
2168
llU
loca I.OW I
local I.Ola
PIO! o! Co1(x) local me
DD
o.e
••
........
02
8
a
B
..,
.OA
,OJI
.o.e
.,
• I
• • V IU
I' Teacher's Signature: _ _ _ _ _ _ _ __
Date .Lti.l.r..J.~..,
[ Expt. No. _______..)___________
r.::., Page No______5______ ]
Exp3,sce
l clc;
z d1sp("Na me-Ak~h deep-Sin qh");
3 ctisp("Ro ll-no-3S4 2080282 2, -Br~nch- ,ECE-A" );
1 N • 80000:
s count • O;
6 !or (1 • l:N)
7 yl • ceil(ran d(l) ·6);
8 y2 • ceil(ran d(l)'6);
9 if((Yl • y2) •• 3)
10 count• count+ l;
ll end
12 probl(1l = count/i;
13 end
14 plot (ptobl):
1s xlabel("N W'l\ber-o t-erial.9" ):
16 ylabel ( "Probab lity");
17 title("Pr obabil1t y-ot-qet tinq-$\ll l\•Of-do t$•On-ta ce$,of-a ,dice,to,
be-3");
18
=
-
1s~s.1.1
<t fl X '/~e:-c-:.
•~-r.Jc.b~ eep S:l.n~h• vu Type V.Wty __,
- - --
l'I St-+04 Ocu,lo local 2168
<!Ult 4.521,-l()J Do<t,le
"Roll no-35420802 822, 5r&nch- ~C?:-A• l>CII 2168
St+<H oa..t,le local 2168
Drd>l 80000xl oa..t,le local
,--> "40.21d!
:Vl s
lv2 I 0o<bl< ...... 2168
2168
Graphic window number 0
f'ole Tools Edit l
- 0 X
'f't• o ! o. .. ...;:71!.1 - .,- ''5:.1
Probability ot gett.ig sum of dots on faces of a dice to be 3 /
0~ ./ - ,~t
11( '
0.0,
0.1145
"'
"'
..
0
0.04
a:
0.1135
I
OJ»
0.025 ,
5000 10000 15000 20000 25000
Numb« of1rialS Teache(sSignature: _ _ _ _ _ _ _ __
- -·
- -
iJU.\..\,,,
~SCI! .~ c.a.l: [ Expt.No, _ __ Page No. -1,_ ]
i l clc:
2 disp(•Na,e •: llshdeep Sinqh•1:
3 disp(•Roll No. : 35420802522"):
4 di.sp(•Branch ·: -tct-A"):
5 n • ~(•Enter the value of n •1:
6 disp(-Values of .x•1:
7 for 1 • l:f
8 x !1 I • (• • I :
9~
10 di.sp('"Val.ue, of i'.91;
u for 1 • l:4
12 f(11 • ~('" ");
13 end
u for 1 • 1:4
15 fx.(11 • f(il • :ii:(11:
16 end
:17 ar • o: •Name : Alcshdeep Singh•
'1s arz • o:
19 for 1-• 1:4
,20 ar • ar + f(il:
•Roll No. : 35420802822• I·
:21 arz • afz + fz(11:
•Branch: ECE-A•
22 end
23 :::ep • SfZ/sf: :nter the value of n : 3
24 P • / n;
25 q"' l - p:
26 ccat>o • [l,3,3,l]: of x•
27 H • 100; 0
28 !or 1 = 1:4
29 ana(il = coabo(il 1
tp~x(ill 1
(~(n-z(ill):
l
30 ans(il = R • ana(11:
31 eod.
'32 disp ( '"tzpec~ Frequency •are • : • • I : 2
! 33 di.sp (ans):
3
off"
10
.. 20
30
40
•Expected Frequency are : •
3.7037037
I 22.222222
44.444444
29.629630 Teacher's Signature: _ _ _ _ _ _ _ __
Date l-i.½
Elq)S.~
l clc;
ciJ, [ Expt. No. _ _ PageNo. J ]
2 disp(•Nuie: Atahdeep Singh•);
3 disp("Roll No. :-35420S02822,,Bt4I1ch•:-ECE-A");
4 n •inW.("Enter the-value of,n :-");
s p • ~("Enter the value of p : ");
6 disp(•valuu of x-: ");
7 tor i • 1:4
8 X(i) • ~ ( • ");
9 end
10 disp(•values off: ")
11 for 1 • l:4
12 C(il • ~ ( " ");
1113 end
! 14 q • l - p; •
15 coabo • [1,3,3,l];
'116B•l00;
17 for i • 1:4
18 am(i) • coabo(il ' (pAx(il) • {~(n-x(il));
19 ana(i) • B' ana(i);
20 end
21 disp (•Expected• frequencies . are . : . •) :
22 disp(11n11);
•Ram, JUl:shdeep Singh•
"Roll No. : 35420802822 ,Branch !C!-A"
:nter the value otft: 3
1ter the value ot p O. 6
•values ot x: •
0
l
2
3
•values of t
10
20
30
40
•Expected frequencies are , •
6.4000000
2e.eooooo
43.2
21.600000
Teacher's Signature: _________
I E,q,6.a IBJ i CtJ, Date _Jl.~
~=-==== =-=-="'": I 1 clc;
2 disp("lfui e ·: -Akshdeep -Singh•); [ Expt. No. _ _ __ PageN o.~-]
3 disp('"Ro ll-llo. •: -3S420802822, -Branch,: -ECE-A•); I
I, n •-~(•En~ er-the-V alue-of- n-: -•t:
I 5 disp('Val ues-of -x-:- ');
1 1 6 for 1-• 1-: n+l; j
, 7 • · Z(l) ·• ~C--• ); i
1
18 end I·,.
119 d1sp(-Va lues-of-f9 ); I
f
: 10 for-1 • 1 : n+l
11 · · · !(1) ·= ~ , - . • , :
I 12 end I J
I i ..
1
13 for -i •• 1- : -n+l
H - rz(1) • !(1). * -x(1): 1-~.
I15 end
j.
\ --
161•!-• O;
U7 srx-•-0;. ··-
' : °\
I
I
il1e for-i-• 1-: -n+l r--·
19 -•r .• -•r -+ rt1>: i -'-
1
20 • - •rx • srz +-Cx(1);
I
1
I
21 end t~- . --
22 mm• sfx-/-st:I __
\.
!I 23 1-- mun,: (. ~-
1 24 B ·•-sum(!);
;- -I
I
I 25 for-1 • -1 : n+l r- -'
I
\ 26 • • -ans (1) • (exp(-1)' (l**x(i)) ) / factorial (.1:(1)):
127 - • ans(1) • B•am(1);
I
i 28end .. -- \ I
!
--· .- ·- 4 - .. - · - - - - - - - - . . J ....
_, -· -·- - .:.!-'•:_ _ •__\
1
2a end
;j 29 clisp ("Expe cted. Freque ncies -are• : -") :
i 30 clisp(a ns);
i 31 sec-=- sum{an s):
(
,1
. 32 disp ("Sum. of -Expec ted• Freque ncies -are - : . ") ; f
i 33 disp{a ef): I
I 34 sor -= -sum{f ): /
f 35 disp ,•sum- of -Obser ved-Fre quenci es -are.: . "); •
! 36 disp {sof); ___ _____ ___ . _______ _j Teacher's Signature: _____ ____
' I

•Name : Akahcteep Sinob"

"Roll No. : SSi20S 02822, Bunc!I !:Cl-A"


nter t!"le Value: ot n : S

"Values ot "
0

WV&lue., ot t,..,

23

21

54

33

22

22

"Exp ected Frequ encie s are "

8.324 6306
24.55 5043

I
36. 21482 7
35.60 7450
26.25 7695
15.49 0389
I
"Sum of Expe cted Frequ encie s are : "

146.4 5003

"Sum of Ob3e rved Frequ encie 3 are: "

159.
~pt. No. _______ Page No. lO ]
Elp7.IQI!
r
1 ele:
2 d1spl"Nue.: -Abhdeep-Sin qh•I;
3 d1ap("Roll-No . -: -35420802822, Branch-:-Ect- A•);
4 n • ~(•tnter-the -Value-of-n -:-•);
5 l • 1JmlK(•Enter- the-Value-of-m ean(11) -: -•1:
6 d1ap('Valuu of-x-: •');
7 for 1 • l : n+l;
e x111 • ~ 1 - ·,:
9 end
10 d1ap("'Valuu .of .f•1;
11 for 1 • l I n+l
12 ((1) • ~ 1 - ., :
13 end
14 • • aum(f);
15 for 1 • l : n+l •
16 w111 • <exp1-11•11•••11111 I toc;or1a11x1111:
17 ana (1) • ··- (1);
18 end
19 d1ap(•Expeet ed-rrequeneie s-are.:.•1:
20 d1ap(w);
21 aer • sum(w):
22 d1ap(•S1.111- of-[l(peeted-rr equeneies-are- : ·");
23 d1.9p(R();
24 80( • SUIII(();
1
25 di.sp/"Sum of-Observed. rrequeneies-a re.:. ");
26 diap (aof);
27
-..._ -
Teacher's Signature: _ _ _ _ _ _ _ _ __
p
\

"Name : Aksh deep Sing h"

"Ro ll No. : 3542 0802 822, Btan ch ECE-A"


ntet the Valu e of n: 4

ntet the Valu e of mean (m) : 4

"Val ues of x: "


0

"Val ues off "


47

18

25

10

\ "Ex pec ted Fre que nci es are . " .


I
1.9 780 890
7.9 123 560
15. 824 712
21. 099 616
21. 099 616

"Sum of Exp ect ed Fre que nci es are


.
• n

67. 914 389

"Sum of Ob ser ved Fre que nci es are


.
• n

108 .
I
,.,_,~ ,.l --.-)--
... , [ Expt. No. _____,_ _ _ Page No. l& ]
1:l ""111doop- (C.'Oolnl!CI: PC11r ooc.-u
•-- I Abhdffp 51nqb" r-----r>cil=
1
- eaJ.e.~~ ., B
l olo;
•Branch z:a-&• 2 disp("N ame: Atshdee p Sinqh") ;
3 disp("B ranch: ECE-A");
•ao11 no. : t7•
·]t.nce.r the value or ••n I O 4 disp("R oll no. : 97");
S mu•~(" Enter• the•va lue of mean: ")1
-");
'ttncer t.be •&lue or •tgaa : 1 6 sic;paa =~("En ter the value of sigma:
7 lambda =~("En ter the value of-lamb
da : ")1
'l,:nuir tile value of 1 - : 0,5
e
9 x=linsp aoe(-5,8 ,100);
lOy_nor aa.l=l / (signia• sqrt(2•1 pi))*ezp
(-0,S*(( x-mu)/s igmaJA 2);
I-> I a•z) 1
11 y_expon enUaJ.•l ambda*e xp (-lambd
12
oraaJ. , '-b'),
113 ~(z,y_n
!14~('x');
15 ('Distri bution functio n' i;
16 '2llu..(z, y_expon enUaJ., ' - r ' ) ;
I ious parame ters');
17 mh('P lot of-norm al-distr ibution for-var
ntial distribu tion'JJ1
18 ~(['N orma l distrib ution', 'Expone
19
20 zq:tld(l , 1, 3); I '½, ,~ t.Wh VZk¼! Jdk &. hWY ;J- I~ /4....4/4·-~~ ,,o·S~ -~~)
Graphic window number 0
File Tcols Edit 7
'01 ·i~ ·~ I6J \o + I
:t:' --·--- ---=- ---·___...._-_-_==-~---·=--=•:::-,- "'="'-.....,,..,
Plot or normal distribution for various parameters
---r----,-----r----~-----~-----~-
== ~
2.11
I I I I
I
---L----~-----~----~-----~-----L-
1
I I
I
2.4 I I I
1 I I
--, ----, ---,
I I
,--
---, ---- ,-----. -----,- ---- ,----·· ,---- ,-----r -----,- ----
I I I I I
I I I I
I
22 I I I I
I I
---~----~-----~----~-----~-----~----~-----~-----~----~--
I I I I
' I I I I I
I I
I
2 I I
I I I
I I I I
• I I I I
I I I I
I I I __
1.8
____ J
- - '
- ' - - -
' - - - -
, - - - -
_____
I

_ _ _ _ _
I

_ _ _ _ _
I

_ _ _ _ _
I
,
____
C
_ _ _ .._
I I I I
I I I I I
0 I I I
I
--
I
-r----,
I I
--r----
I
--~---
I
1 •e ----r-- t I
----T-
I
r----,-
I
-,-----
I
C
,2
---r---
1 I I I I f I I I
I
I
I
I I f I

I
I I I
----~-- ---L-- ---L-- --~--
1.4 --~L-- --~---- -L---- ~-----~ -----L
I I I I I
I I
1 I t
I I I I
5 I I
---- ,--
I I I
:S! 12 ---;-
I
I
- ,-----r
I I I
---- ,-----7 -----,-
I I I
--- ,-----, -----,-
I
J:: I I I I
Ill , I
I
~- -
I
-:----~ - --- -;-- ---~ - ---~-- ---:--- - -;-----
I I I
0 I ,
- --~I -- -- I I I I I
---L ____ _, ____ _ I I
-----~- -•__ J __
I
0.8 ---~--- --i---- -L---- ~-----L
X
I
' ' I
I
I
I
I
I
I
I
I
I I
I
- - -:--
I
- -~
I
- --:- --__ i ___ --:---- - : -T-
I I I
0.6 I I I .
- - - - ~- - - - - ~ - - - - -;- - - - - ~
--
---~----~-----~---~----~-----~-----~----~--
t I I I I I
I I I
0.4 1
• I I
02 ~ - - - J __
-2 -1.5 -1 -0.5 0 0.5 1.5 2 2.5
X
Teacher's Signature :

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy