Vous êtes sur la page 1sur 12

Chapter 1

Q. 1a)
>> ((28.5*3^3) - sqrt(1500))/(11^2+37.3)
ans =
4.6164
Q. 1b)
>> ((7/3)^2*4^3*18)-(6^7/(9^3-652))
ans =
2.6365e+03
Q. 2a)
>> 23*(-8+sqrt(607)/3)+(40/8+4.7^2)^2
ans =
738.7546
Q. 2b)
>> 509^(1/3)-4.5^2+log(200)/1.5+75^(1/2)
ans =
-0.0732
Q. 3a)
>> (24+4.5^3)/(exp(4.4)-log10(12560))
ans =
1.4883
Q. 3b)
>> (2/0.036)*((sqrt(250)-10.5)^2/exp(-0.2))
ans =
1.9143e+03
Q.13)
>> (1/2*x2-1/4*sin(2*x2))-(1/2*x1-1/4*sin(2*x1))
ans =
1.1210
Q. 16)
>> A=2; B=-7; C=-10; x0=3; y0=-4;
>> d = abs(A*x0+B*y0+C)/sqrt(A^2+B^2)
d=
3.2967

Q. 19)
>> n=12; r=5;

>> Cnr=factorial(n)/(factorial(r)*factorial(n-r))
Cnr =
792
Q. 20a)
>> log(281)/log(5)
ans =
3.5033
Q. 20b)
>> log10(1054)/log10(7)
ans =
3.5769
Q. 25)
>> A=16.0137; B=3096.52; C=-53.67; T1=315; T2=405;
>> p=A-B/(C+T1);
>> p=log(p)
p=
1.4266
>> p=A-B/(C*T2);
>> p=log(p)
p=
2.7823

Chapter 2
Q. 1)
>> r_v=[6 8*3 81 exp(2.5) sqrt(65) sin(pi/3) 23.05]
r_v =
6.0000 24.0000 81.0000 12.1825 8.0623 0.8660 23.0500
Q. 2)
>> c_v=[44; 9; log(51); 2^3; 0.1; 5*tand(25)]
c_v =
44.0000
9.0000
3.9318
8.0000
0.1000
2.3315

Q. 7)
>> v=linspace(4,4,11)

v=
4

>> same=v(1:11)
same =
4 4 4 4

Q. 9)
>> B=[0:4:28; linspace(69,62,8); 1.4:-0.3:-0.7]
B=
0 4.0000 8.0000 12.0000 16.0000 20.0000 24.0000 28.0000
69.0000 68.0000 67.0000 66.0000 65.0000 64.0000 63.0000 62.0000
1.4000 1.1000 0.8000 0.5000 0.2000 -0.1000 -0.4000 -0.7000
Q. 12a)
a = 0:2:6
a= 0 2 4 6
>> a=0:2:6
a=
0 2 4

Q. 12b)
b = [a a] or b = [a, a]
b=02460246
>> b = [a a]
b=
0 2 4

Q. 12c)
c = [a; a]
c=
0246
0246
>> c=[a; a]
c=
0 2 4
0 2 4

6
6

Q. 12d)
d = [a' a'] or d = [a', a']
d=
00
22
44
66
>> d=[a' a']
d=

0
2
4
6

0
2
4
6

Q.13)
v = [2, 7, -3, 5, 0, 14, -1, 10, -6, 8]
>> v=[2, 7, -3, 5, 0, 14, -1, 10, -6, 8]
v=
2 7 -3 5 0 14 -1 10

-6

Q. 13a)
a = v(3:6)
a = -3 5 0 14
>> a=v(3:6)
a=
-3 5 0

14

Q. 13b)
b = v([2, 4:7, 10])
b = 7 5 0 14 -1 8
>> b=v([2, 4:7, 10])
b=
7 5 0 14 -1

Q. 13c)
c = v([9, 3, 1, 10])
c = -6 -3 2 8
>> c=v([9, 3, 1, 10])
c=
-6 -3 2 8
Q. 13d)
d = [v([1, 3, 5]); v([2, 4, 6]); v([3, 6, 9])]
d=
2 -3 0
7 5 14
-3 14 -6
>> d=[v([1, 3, 5]); v([2, 4, 6]); v([3, 6, 9])]
d=
2 -3 0
7 5 14
-3 14 -6
Q. 18a)
>> a=[zeros(2,3) ones(2,3)]

a=
0
0

0
0

0
0

1
1

1
1

1
1

Q. 18b)
>> b=[ones(4,1) eye(4)]
b=
1 1 0 0 0
1 0 1 0 0
1 0 0 1 0
1 0 0 0 1
Q. 18c)
>> c=[ones(1,2); zeros(2,2); ones(1,2)]
c=
1 1
0 0
0 0
1 1

Chapter 3
Q. 1)
>> x=[-2 -1 0 1 2 3 4 5]
x=
-2 -1 0 1 2 3

>> y=(2.*x.^2 - 5.*x + 4).^3. / x.^2


y=
1.0e+03 *
2.6620 1.3310
Inf 0.0010 0.0020

0.0381

0.2560

0.9756

Q. 4)
g=9.81;
Cd=0.5;
roh=1.2;
m=0.624;
r=0.117;
A=pi*r^2;
t=[0 1 2 3 4 5 6 7 8 9 10];
vt=sqrt((2*m*g)/(roh*A*Cd))*(1 - exp(-sqrt((roh*g*Cd*A)/(2*m)).*t))

Output:
vt =

Columns 1 through 10
0 7.8984 12.9328 16.1417 18.1870 19.4907 20.3217 20.8513 21.1889 21.4041
Column 11
21.5413
Q. 6)
g=9.81;
v0=100;
theta=79;
t=0:2:20;
xt=v0*cosd(theta).*t;
yt=v0*sind(theta).*t-1/2*g.*t.^2;
rt=sqrt(xt.^2 + yt.^2)
Output:
rt =
Columns 1 through 10
0 180.7792 323.3089 427.9925 495.4815 526.8909 524.2756 491.7770 438.6131 386.7074
Column 11
381.6201
Q. 7a)
>> u=[4 9 -5];
>> v=[-3; 6; -7];
>> uv=u*v
uv =
77
Q. 7b)
>> u=[4 9 -5];
>> v=[-3 6 -7];
>> uv=dot(u,v)
uv =
77
Q. 14a)
>> A=[5 2 4; 1 7 -3; 6 -10 0]
A=
5 2 4
1 7 -3
6 -10 0
>> B=[11 5 -3; 0 -12 4; 2 6 1]
B=
11 5 -3
0 -12 4
2 6 1
>> C=[7 14 1; 10 3 -2; 8 -5 9]
C=

7 14
10 3
8 -5

1
-2
9

>> A+B
ans =
16 7 1
1 -5 1
8 -4 1
>> B+A
ans =
16 7 1
1 -5 1
8 -4 1
A+B = B+A (addition of matrices is commutative)
Q. 14b)
>> A+(B+C)
ans =
23 21 2
11 -2 -1
16 -9 10
>> (A+B)+C
ans =
23 21 2
11 -2 -1
16 -9 10
A+(B+C) = (A+B) (addition of matrices is associative)
Q. 14c)
>> 5*(A+C)
ans =
60 80 25
55 50 -25
70 -75 45
>> 5*A + 5*C
ans =
60 80 25
55 50 -25
70 -75 45
5*(A+C) = 5*A + 5*C (scalar multiplication of matrices is distributive)

Q. 14d)
>> A*(B+C)

ans =
150 81 34
58 -47 -18
8 204 -32
>> A*B + A*C
ans =
150 81 34
58 -47 -18
8 204 -32
A*(B+C) = A*B + A*C (matrix multiplication is distributive)
Q. 20)
>> A=[1.5 -2 1 3 0.5; 3 1 -1 4 -3; 2 6 -3 -1 3; 5 2 4 -2 6; -3 3 2 5 4]
A=
1.5000 -2.0000 1.0000 3.0000 0.5000
3.0000 1.0000 -1.0000 4.0000 -3.0000
2.0000 6.0000 -3.0000 -1.0000 3.0000
5.0000 2.0000 4.0000 -2.0000 6.0000
-3.0000 3.0000 2.0000 5.0000 4.0000
>> B=[7.5; 16; 78; 71; 54]
B=
7.5000
16.0000
78.0000
71.0000
54.0000
>> X=A\B
X=
5.0000
7.0000
-2.0000
4.0000
8.0000

Chapter 4
Q. 1)
% A paper cup shaped as a frustum of cone with R2 = 1.25R1
% Program to determine R1, R2, and the surface area, S, of the
% paper cups with different heights (h)
V=250;
h=[5 6 7 8 9 10];
R1=sqrt((3*V)./(pi.*h)*(1+1.25+1.25^2))
R2=1.25.*R1
S=pi.*(R1+R2).*sqrt((R2-R1).^2+h.^2+pi.*R1.^2)

Output:
>> Ch4_1

R1 =
13.4920 12.3164 11.4028 10.6663 10.0563 9.5403
R2 =
16.8650 15.3955 14.2535 13.3329 12.5704 11.9253
S=
1.0e+03 *
2.3521 1.9892 1.7392 1.5608 1.4306 1.3345
Q. 4)
% Radioactive decay of Technetium-99
% Program to calculate the relative amount of Technetium-99 (ArA0)
% in a patient body for 24 hrs. after receiving a dose
k=log(1/2)/6;
t=0:2:24;
ArA0=exp(k.*t)

Output:
ArA0 =
Columns 1 through 10
1.0000 0.7937 0.6300
Columns 11 through 13
0.0992 0.0787 0.0625

0.5000

0.3969

0.3150

0.2500

0.1984

0.1575

Q. 5)
% Program to determine the balance in a saving account at the end
% of every year for the first 10 years. To display the information
% in a table. Initial investment (A), interest rate (r), and
% balance after n years (B)
clear all
format bank
A=1000;
r=6.5;
n=1:10;
B=A.*(1+r/100).^n;
tableB(:,1)=n';
tableB(:,2)=B';
disp(' ')
disp('
No.
Balance')
disp('
of Years
($)')
disp(tableB)

Output:
>> Ch4_5
No.
of Years
1.00
2.00
3.00
4.00
5.00
6.00
7.00

Balance
($)
1065.00
1134.22
1207.95
1286.47
1370.09
1459.14
1553.99

0.1250

8.00
9.00
10.00

1655.00
1762.57
1877.14

Q. 7)
% Program to calculate the vapor pressure of benzene
% at various temperatures
clear all
format short
a=34172;
b=7.9622;
T=0:2:42;
logP=b-0.05223*a./(T+273);
p=10.^logP;
tableVP(:,1)=T';
tableVP(:,2)=p';
disp(' ')
disp('Temperature Pressure')
disp(' (deg. C)
(mm Hg)')
disp(tableVP)

Output:
>> Ch4_7
Temperature Pressure
(deg. C) (mm Hg)
0 26.5741
2.0000 29.6487
4.0000 33.0268
6.0000 36.7328
8.0000 40.7930
10.0000 45.2349
12.0000 50.0877
14.0000 55.3825
16.0000 61.1518
18.0000 67.4302
20.0000 74.2541
22.0000 81.6617
24.0000 89.6934
26.0000 98.3914
28.0000 107.8003
30.0000 117.9666
32.0000 128.9392
34.0000 140.7692
36.0000 153.5100
38.0000 167.2175
40.0000 181.9501
42.0000 197.7684
Q. 8)

% Program to calculate the heat capacity for four different gases


% at temperatures ranging between 200 and 400 deg. C
clear all

T=200:20:400;
a1=38.91; a2=48.50; a3=29.10; a4=29.00;
b1=3.904*10^-2; b2=9.188*10^-2; b3=1.158*10^-2; b4=0.2199*10^-2;
c1= -3.105*10^-5; c2=-8.540*10^-5; c3=-0.6076*10^-5; c4=-0.5723*10^-5;
d1=8.606*10^-9; d2=32.40*10^-9; d3=1.311*10^-9; d4=-2.871*10^-9;
Cp1=a1+b1.*T+c1.*T.^2+d1.*T.^3;
Cp2=a2+b2.*T+c2.*T.^2+d2.*T.^3;
Cp3=a3+b3.*T+c3.*T.^2+d3.*T.^3;
Cp4=a4+b4.*T+c4.*T.^2+d4.*T.^3;
tableCp(:,1)=T';
tableCp(:,2:5)=[Cp1' Cp2' Cp3' Cp4'];
disp(' ')
disp(' Temperature
Heat Capacities')
disp('
deg. C
J/(g mol)(deg. C)')
disp(' ')
disp('
SO2
SO3
O2
N2')
disp(' ')
disp(tableCp)

Output:
>> Ch4_8
Temperature
deg. C

200.0000
220.0000
240.0000
260.0000
280.0000
300.0000
320.0000
340.0000
360.0000
380.0000
400.0000

Heat Capacities
J/(g mol)(deg. C)
SO2

SO3

O2

45.5448
46.0876
46.6101
47.1127
47.5958
48.0599
48.5053
48.9325
49.3418
49.7338
50.1088

63.7192
64.9252
66.0801
67.1852
68.2423
69.2528
70.2183
71.1404
72.0206
72.8605
73.6616

31.1834
31.3675
31.5473
31.7231
31.8948
32.0626
32.2264
32.3863
32.5425
32.6950
32.8437

N2
29.1879
29.1762
29.1584
29.1344
29.1040
29.0671
29.0236
28.9732
28.9160
28.8517
28.7802

Q. 9)
% Program to calculate the heat capacity of an ideal mixture of four
% gases at three different temperatures
clear all
format compact
T=[25 150 300];
Cpm1=39.82; Cpm2=44.72; Cpm3=49.10;
a1=38.91; a2=48.50; a3=29.10; a4=29.00;
b1=3.904*10^-2; b2=9.188*10^-2; b3=1.158*10^-2; b4=0.2199*10^-2;
c1= -3.105*10^-5; c2=-8.540*10^-5; c3=-0.6076*10^-5; c4=-0.5723*10^-5;
d1=8.606*10^-9; d2=32.40*10^-9; d3=1.311*10^-9; d4=-2.871*10^-9;
Cp1=a1+b1.*T+c1.*T.^2+d1.*T.^3;
Cp2=a2+b2.*T+c2.*T.^2+d2.*T.^3;
Cp3=a3+b3.*T+c3.*T.^2+d3.*T.^3;
Cp4=a4+b4.*T+c4.*T.^2+d4.*T.^3;
A(:,1:4)=[Cp1' Cp2' Cp3' Cp4'];

A(4,:)=[1 1 1 1];
B=[Cpm1; Cpm2; Cpm3; 1];
X=A\B;
x1=X(1,:)
x2=X(2,:)
x3=X(3,:)
x4=X(4,:)

Output:
>> Ch4_9
x1 =
0.1477
x2 =
0.4212
x3 =
0.1002
x4 =
0.3308
Q.14)

% Program to calculate the coefficients of


% dissolution of copper sulfide in aqueous
clear all
A = [1 0 0 -1 0 0 0; 1 0 0 0 -1 0 0; 0 1 0
0 3 0 0 -4 -1 -1; 0 0 1 0 0 0 -2; 0 -1
C = [0; 0; 0; 0; 0; 0; 3];
X = A\C;
a=round(X(1,:))
b=round(X(2,:))
c=round(X(3,:))
d=round(X(4,:))
e=round(X(5,:))
f=round(X(6,:))
g=round(X(7,:))

Output:
>> Ch4_14
a=
3
b=
8
c=
8
d=
3
e=
3
f=
8
g=
4

the balanced formula of the


nitric acid.
0 0 -1 0; ...
1 -2 2 0 0; 1 0 0 0 0 0 0];

Vous aimerez peut-être aussi