logo

Solved problems on MATLAB for engineering students

   

Added on  2022-11-13

11 Pages983 Words452 Views
Set 1
Problem 1
clc
a = [ 4.5 4.61 3.26 1.46 0.7 0.16 0 0.06 0.12 0.12 1.12 3.16 4.56 ] ;
display ('The data in inches:');
display ( a );
b = a * 0.0254;
display ('The data in meters:');
display ( b );
s=0;
for (i= 1:12)
s = s + b(i);
end
v = s * 40.25 * 1000000;
vl = v * 1000;
vg = vl/3.78;
display (' Volume in litres:');
display (vl);
display (' Volume in gallons:');
display (vg);
vtl = s * 10 * 30 * 0.3048 * 0.3048 *1000;
vtg = vtl / 3.78;
display ('amount of rain water collected by the system in a year in
litres:');
display (vtl);
display ('amount of rain water collected by the system in a year in
gallons:');
display (vtg);
du = [ 8.8 10 8.2 0.7 1.2 4 10.8 1.6 ] ;
display ('Daily usage in gallons: ');
display (du);
dl = du * 3.78 ;
display ('Daily usage in litres: ');
display (dl);
dy = dl * 365 ;
display ('Yearly water usage in litres for each activity: ');
display (dy);
s1=0;
for (j= 1:8)
s1 = s1 + dl(j);
end
yu = s1 * 365 ;
display (' Yearly Water usage of 1 person');
display (yu);

Output:
The data in inches:
a =
Columns 1 through 12
4.5000 4.6100 3.2600 1.4600 0.7000 0.1600 0 0.0600
0.1200 0.1200 1.1200 3.1600
Column 13
4.5600
The data in meters:
b =
Columns 1 through 12
0.1143 0.1171 0.0828 0.0371 0.0178 0.0041 0 0.0015
0.0030 0.0030 0.0284 0.0803
Column 13
0.1158
Volume in litres:

vl =
1.9701e+10
Volume in gallons:
vg =
5.2118e+09
amount of rain water collected by the system in a year in litres:
vtl =
1.3642e+04
amount of rain water collected by the system in a year in gallons:
vtg =
3.6089e+03
Daily usage in gallons:
du =
8.8000 10.0000 8.2000 0.7000 1.2000 4.0000 10.8000 1.6000

Daily usage in litres:
dl =
33.2640 37.8000 30.9960 2.6460 4.5360 15.1200 40.8240 6.0480
Yearly water usage in litres for each activity:
dy =
1.0e+04 *
1.2141 1.3797 1.1314 0.0966 0.1656 0.5519 1.4901 0.2208
Yearly Water usage of 1 person
yu =
6.2500e+04
Set 1
Problem 2
clc
vs = 0.01;

End of preview

Want to access all the pages? Upload your documents or become a member.