Tuesday, October 13, 2015

Day - 11 Solving System of Equations


We started the day with working on circuit problem here is a picture:

Solving Simultaneous Equations in an Electric Circuit ex.
We then talked about reduced row echelon function, rref and we can rewrite matrices in that form.
We then did an example of  a material balances desalination unit. Here is a picture:

Material Balances on a Desalination Unit

We then move onto a Force on a Statically Determinate Truss example. Here is picture:

A Force on a Statically Determinate Truss

Lastly we finish the day with special types of matrices like pascal and magic.

Conclusion:
Solving linear algebra systems is easy with matlab. However using which type on method is important, like ref, rref, or other forms like the first example tied in class.

%%HMWK 11
%hmwk 11-1
doublea = 5 - 3i %double complex, 16 bytes
singlea = single(5 - 3i)  %Single complex, 8 bytes
k1 = doublea^100 %double complex raise 100 power
k2 = singlea^100 %single comples raise 100 power
% k1 returns intergers vaules of double complex
% k2 returns -inf and +inf in single complex
% the reason being the scope of single cant handle 100 power byte "weight"
%hmwk 11-2
char(85) %one element
num2str(8)
char(56)
char(53)
%hmwk 11-3
mess = input('words','s') %message input
encode = char(mess+11) %encode message
decode = char(encode-11) %decode message
%hm11-4
k = 1;
response = menu('Would you like to enter planetary data?','yes','no');
while response==1
disp('Remember to enter strings in single quotes')
planetary(k).name = input('Enter a planet names','s');
planetary(k).mass = input('Enter the mass in multiples of earth''s mass: ');
planetary(k).year = input('Enter the length of the planetary year in Earth years: ');
planetary(k).velocity = input('Enter the mean orbital velocity in km/sec: ');
planetary(k)
increment = menu('Was the data correct?','Yes','No');
switch increment
case 1
increment = 1;
case 2
increment = 0;
end
k = k+increment;
response = menu('Would you like to enter more planetary data?','yes','no');
end
plan2 = {planetary.name; planetary.mass; planetary.year; planetary.velocity}
oo = struct2table(planetary) %struct table command

%hmwk 11-5
metal = {'Aluminum' ,'Copper ','Iron ','Molybdenum ','Cobalt ','Vanadium '} %metal names
sy = ['AL', 'Cu', 'Fe', 'Mo', 'Co', 'V'] %element symbolys
atomicn = int8([13 29 26 42 27 23]) %atomic number of elements
atomicw = [26.98 63.55 55.85 95.94 58.93 50.94] %atomic weight of elements
den = single([2.71 8.94 7.87 10.22 8.9 6.0]) %density of each element g/cm
ty = ['FCC','FCC','BCC','BCC','HCP','BCC'] %type of structre per element
super = {metal sy atomicn atomicw den ty} %super cell of 6 different arrays
cell2table(super)
sup1 = [super{1}(4) super{4}(4) super{6}(10:12)] %cell sup1 is forth deep in super cell
sup2 = [super{1}]' %names of elements in metal cell
sup3 = sum(super{4}/length(super{4})) %average atomic weight of forth column

No comments:

Post a Comment