We started the day with some liner algebra. Matrix operations and functions were worked on like dot product and matrix multiplications. WE then move on to central of gravity example of nuts and screws, then move onto forces on a point.
Here are some pictures of examples done in class:
Conclusion:
Matrices multiplication and dot product and other mathematical operations can be done, with special syntax like a . before operations for matrices. Always keep in mind the dimensions of matrices when trying to do operations with other matrices.
%Hmwk 10
co = [3 4 2 -1 1 7 1;2 -2 3 -4 5 2 8;1 2 3 1 2 4 6;5 10 4 3 9 -2 1;3 2 -2 -4 -5 -6 7;-2 9 1 3 -3 5 1;1 -2 -8 4 2 4 5]
x = [42 32 12 -5 10 18 17]
tic
result = co\x'
toc
tic
result1 = inv(co)*x'
toc
%Hmwk 10-2
co = [.2 .65 0;.35 .25 -100;.45 .1 100] %coefficents for water, ethanol, methanol
b = [50 0 50] % mass amount
amount = co\b' %percent for water, ethanol methanol
fprintf(' mass top %3.2f \n mass bottom %3.2f \n percent methanol %3.2f \n',amount)
%Hmwk 10-3
format short
theta1=45 % angle in degrees
theta2=65 % angle in degrees
F1x=-1000*cosd(30) % horizontal load
F1y=-1000*sind(30) % vertical load
A=[-cosd(theta1),cosd(theta2),0,0,0,0; -sind(theta1),-sind(theta2),0,0,0,0; cosd(theta1),0,1,1,0,0; sind(theta1),0,0,0,1,0;0,-cosd(theta2),-1,0,0,0; 0,-sind(theta2),0,0,0,-1]
B=[-F1x,-F1y,0,0,0,0]'
x=(A\B )' % use left division
fprintf(' f1 is %3.2f N \n f2 is %3.2f N \n f3 is %3.2f N \n f2 react x is %3.2f N \n f2 react y is %3.2f N \n f3 react y is %3.2f N \n',x);
No comments:
Post a Comment